|
问题出现在登陆窗体(设计的),在点击登陆后出现错误对话框 "运行时错误 91 ,对象变量或with 块变量未设置"
代码如下:
Private Sub confirm_button_Click() '登陆按钮事件
Dim stDocName As String
Dim stLinkCriteria As String
If IsNull(user) Then
MsgBox "请选择登录用户!", vbCritical, "提示"
Exit Sub
ElseIf IsNull(password) Then
MsgBox "密码不能为空,请重新输入!", 64, "提示"
Me.password.SetFocus
Exit Sub
End If
Set rsX = CurrentDb.OpenRecordset("select * from [yhb] where [用户名]='" & user & "' and [密码]='" & password & "'")
If Not rsX.EOF Then
user_level = level
login_successful = 1
user_name = user
rsX.Close
Me.Visible = False '隐藏窗体
stDocName = "主控制面板" '打开主控制面板
Cmd.OpenForm stDocName, , , stLinkCriteria
Else
If I < 2 Then
MsgBox "用户名或密码错误,请重新输入!您还可以输入" & 2 - I & "次密码。", 16, "提示"
password.SetFocus
password = Null
I = I + 1
rsX.Close
Else
MsgBox "您已经连续3次输入错误密码,系统马上关闭!", 16, "提示"
DoCmd.Close acForm, Me.Name
DoCmd.Quit
End If
End If
End Sub
***********其余代码略*****
问题就出现在红色的字段!!!!!!
可是在acess中就不会出现这样的问题.请问我该如何解决~~~~先谢过!!! |
|