运行时老是弹出“无效使用Null”,
Private Sub Command2_Click()
Dim str As String
If IsNull(Me![用户名]) Then
MsgBox "请输入用户名!"
用户名.SetFocus
ElseIf IsNull(Me![密码]) Then
MsgBox "请输入密码!"
密码.SetFocus
Else
str = DLookup("密码", "登陆", "用户名" = "" & Me![用户名] & "")
If IsNull(str) Then
DoCmd.Close , , acSaveNo
Else
If CStr(Me![密码]) = str Then
DoCmd.Close
DoCmd.OpenForm ("库存管理系统主控界面")
Else
MsgBox "您输入的密码不正确!", vbCritical, "密码错误"
End If
End If
End If
Private Sub Command2_Click()
Dim str As String
If IsNull(Me![用户名]) Then
MsgBox "请输入用户名!"
用户名.SetFocus
ElseIf IsNull(Me![密码]) Then
MsgBox "请输入密码!"
密码.SetFocus
Else
str = DLookup("密码", "登陆", "用户名" = "" & Me![用户名] & "")
If IsNull(str) Then
DoCmd.Close , , acSaveNo
Else
If CStr(Me![密码]) = str Then
DoCmd.Close
DoCmd.OpenForm ("库存管理系统主控界面")
Else
MsgBox "您输入的密码不正确!", vbCritical, "密码错误"
End If
End If
End If
