vb登陆错误三次而没有退出程序,是什么原因?高手看一下哪里错了,谢了哈!

来源:百度知道 编辑:UC知道 时间:2024/06/18 05:51:02
Private Sub cmdOK_Click()

Dim txtSQL As String
Dim mrc As ADODB.Recordset
Dim MsgText As String

username = ""

If Trim(txtUserName.Text = "") Then
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else
txtSQL = "select * from user_Info where user_ID = '" & txtUserName.Text & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = True Then
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else
If Trim(mrc.Fields(1)) = Trim(txtPassword.Text) Then
OK = True
mrc.Close
Me.Hide
username = Trim(txtUserName.Text)
Else
MsgBox &quo

你在
miCount = miCount + 1
If miCount = 3 Then
Me.Hide

上加三个断点,然后用f8执行,看看有没按你的要求执行就知道了。

另外me.hide 可以改为end结束程序。