|
用ADO(或DAO)来处理就可以了。
On Error GoTo Err_cmdLogin_Click
Dim rs As New ADODB.Recordset
Dim str As String
Dim num As Integer
str = "select COUNT(Person4.ID) from Person4 where Person4.ID='" & Me.UserName
str = str & "' and Person4.PassWord='" & Me.PassWord & "'"
rst.open str,3,1
num = rs("用户名")
If IsNull(Me.UserName) Then
MsgBox ("请输入用户名称!"), vbInformation, "出错"
ElseIf IsNull(Me.PassWord) Then
MsgBox ("请输入用户密码!"), vbInformation, "出错"
ElseIf num <> 1 Then
MsgBox ("没有这个用户,或者密码错误,重新确认输入后还不能登陆时请通知管理员!"), vbCritical, "出错"
Else
Me.Visible = False
DoCmd.OpenForm "FrmMenu"
DoCmd.RunMacro "Mac_SysUsLogOn" '把信息写入用户登录表
End If
Exit_cmdLogin_Click:
Exit Sub
Err_cmdLogin_Click:
MsgBox (Err.Description)
Resume Exit_cmdLogin_Click |
|