实时错误‘91’高手帮忙看看代码错误
' ******************************************************************************'窗体公共变量定义
' ******************************************************************************
Option Explicit
'记录确定次数,超过3,退出此次登录
Dim miCount As Integer
Private Sub cmdCancel_Click()
'取消,则gLoginSucceeded为False
gLoginSucceeded = False
End
End Sub
Private Sub cmdOK_Click()
Dim txtSQL As String
Dim rstLogin As ADODB.Recordset
Dim flag As String
gUserName = ""
gUserKind = ""
If Trim(txtUserName.Text = "") Then
MsgBox "用户名不能为空!", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else
txtSQL = "select * from tbUser where UserId = '" & txtUserName.Text & "'"
flag = ExecuteSQL(txtSQL, rstLogin, False)
If rstLogin.EOF = True Then
MsgBox "没有这个用户,请重新输入!", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else
If Trim(rstLogin.Fields(1)) = Trim(txtPassword.Text) Then
gUserName = Trim(txtUserName.Text)
gUserKind = Trim(rstLogin.Fields(2))
gLoginSucceeded = True
rstLogin.Close
Me.Hide
frmMain.Show
Else
MsgBox "密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
txtPassword.SetFocus
txtPassword.Text = ""
End If
End If
End If
miCount = miCount + 1
If miCount = 3 Then
Me.Hide
Exit Sub
End If
End Sub