|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Private Sub OK___Click()
On Error GoTo Err_OK___Click
Dim strSQL As String
Dim rs As New ADODB.Recordset
If IsNull(Me.UserName) Or Me.UserName = "" Then
DoCmd.Beep
MsgBox ("请输入用户名称!")
ElseIf IsNull(Me.Password) Or Me.Password = "" Then
DoCmd.Beep
MsgBox ("请输入密码!")
Else
strSQL = "SELECT * FROM 管理员 WHERE 用户名='" & Me.UserName & "' and 密码='" & Me.Password & "'"
Set rs = GetRs(strSQL)
If rs.EOF Then
DoCmd.Beep
MsgBox ("用户名或密码错误!")
Me.UserName = ""
Me.Password = ""
Me.UserName.SetFocus
Exit Sub
Else
DoCmd.Close
check = True
DoCmd.OpenForm ("主切换面板")
End If
End If
Set rs = Nothing
Exit_OK___Click:
Exit Sub
Err_OK___Click:
MsgBox (Err.Description)
Debug.Print Err.Description
Resume Exit_OK___Click
End Sub
小弟刚刚学习ACCESS,对应“Access在人事管理中的应用”制作
现在登陆框不知道,怎么回事,就错误了。
|
|