Private Sub Cmd确定_Click()
On Error GoTo Err_Cmd确定_Click
Dim msg, strPass, sName As String
If IsNull(Me.Combo用户名) Then
MsgBox "请先选择登陆的用户", vbInformation + vbOKOnly, "提示"
Exit Sub
End If
If IsNull(Me.Txt密码) Then
MsgBox "密码不能为空", vbInformation + vbOKOnly, "提示"
Exit Sub
End If
strPass = DLookup("密码", "用户密码表", "[密码]" = "" & Me.Txt密码 & "")
If Not (strPass) Then
DoCmd.Close acForm, "登陆"
DoCmd.Close acForm, "登陆背景", acSaveYes
DoCmd.OpenForm "切换面板", acNormal
Else
msg = MsgBox("密码错误!请重新输入正确的密码", 16, "警告")
Me.Txt密码.SetFocus
Me.Txt密码 = Null
End If
Exit_Cmd确定_Click:
Exit Sub
Err_Cmd确定_Click:
MsgBox Err.Description
Resume Exit_Cmd确定_Click
End Sub