[求助]关于with块变量未设置的问题
Dim txtSQL As String
Dim MsgText As String
Private Sub Command1_Click()
Dim mrc As ADODB.Recordset
txtSQL = "select * from oper where 用户名='" & Trim(Text1.Text) & "'" & " and 口令='" & Trim(Text2.Text) + "'"
Set mrc = ExeSQL(txtSQL, MsgText)
If mrc.RecordCount = 0 Then
n = n + 1
If n < 3 Then
MsgBox "没有这个用户,继续登录", vbOKOnly + vbExclamation, "信息提示"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
Else
MsgBox "已登录失败三次,退出系统", vbOKOnly + vbExclamation, "信息提示"
mrc.Close
Unload Me
End If
Else
userlevel = Trim(mrc.Fields("级别"))
mrc.Close
Unload Me
main.Show
End If
End Sub
运行程序时出现提示“对象变量或with块变量未设置”,应该如何添加程序呢?请高手指教!