VB 登录验证问题
本帖最后由 bcrun 于 2013-04-11 09:44:41 编辑
Private Sub cmdOk_Click()
'登录
If Trim(Me.txtName.Text) <> "" Then
Sql = "select 密码 from 密码表 where 用户名='" & Trim(Me.txtName.Text)
Sql = Sql & "' and 类型='" & Trim(Me.cboType.Text) & "'"
Set RS = dbSelect(Sql)
If RS.EOF And RS.BOF Then
MsgBox "无此用户!"
Else
If Me.txtPwd.Text = RS.Fields(0) Then
mdiMain.Show
If Me.cboType.Text = "管理员" Then
mdiMain.mnuSysSetUser.Visible = False
mdiMain.mnuSysDelUser.Visible = False
ElseIf Me.cboType.Text = "销售员" Then
mdiMain.mnuSysSetUser.Visible = False
mdiMain.mnuSysDelUser.Visible = False
mdiMain.mnuCheck.Visible = False
mdiMain.mnuReport.Visible = False
mdiMain.mnuSellReport.Visible = False
mdiMain.mnuSellDay.Visible = False
mdiMain.mnuSellCheck.Visible = False
mdiMain.mnuOther.Visible = False
Else
mdiMain.mnuReportUser.Visible = True
End If
mdiMain.Caption = "销售系统 " & "(当前用户:" & Format(Trim(Me.cboType.Text), "#####") & " " & Trim(Me.txtName.Text) & ")"
mdiMain.Tag = Trim(Me.txtName.Text)
Unload Me
Else
MsgBox "密码或者用户名不正确!"
Me.txtName.SetFocus
End If
End If
Else
MsgBox "用户名不能为空!"
Me.txtName.SetFocus
End If
End Sub