vb新手,高人们帮忙给看看多谢1
vb新手求助,高人们帮忙给看看谢谢1
Private Sub Command1_Click()
Dim UserID_Login As String
Dim Password_Login As String
Dim i As Integer
If Me.Text4.Text = "" Then
MsgBox "请输入用户工号!", vbOKOnly, "系统提示!"
Me.Text4.SetFocus
Exit Sub
End If
If Me.Text5.Text = "" Then
MsgBox "请输入密码", vbOKOnly, "系统提示!"
Me.Text5.SetFocus
Exit Sub
End If
UserID_Login = Me.Text4.Text
Password_Login = Me.Text5.Text
Me.Adodc1.Refresh
Do While Not Me.Adodc1.Recordset.EOF
If Me.Adodc1.Recordset.Fields("gonghao") = UserID_Login Then
Password_Login = Me.Adodc1.Recordset.Fields("mima")
If Me.Text5.Text <> Password_Login Then
MsgBox "密码不正确!", vbOKOnly, "系统提示!"
Me.Text4.Text = ""
Me.Text5.Text = ""
Me.Text4.SetFocus
Exit Sub
Else
frm_main.Show
Unload Me
End If
End If
Me.Adodc1.Recordset.MoveNext
Loop
MsgBox "无此用户,请重新输入!", vbOKOnly, "系统提示!"
Me.Text4.Text = ""
Me.Text5.Text = ""
Me.Text4.SetFocus
End Sub
运行后,提示下面的这一句 Me.Adodc1.Recordset.MoveNext 有误,
错误信息:
事实错误“91”
对象变量或with块变量未设置
------解决思路----------------------
打印出Adodc1.Recordset.recordcount是几?
debug.print Adodc1.Recordset.recordcount
------解决思路----------------------
同意!
------解决思路----------------------
select mima from 表名 where gonghao = UserID_Login
得到密码然后判断和输入的密码是否一致
你的问题在于用户命、密码一致的时候没有退出循环过程
Private Sub Command1_Click()
Dim UserID_Login As String
Dim Password_Login As String
Dim i As Integer
If Me.Text4.Text = "" Then
MsgBox "请输入用户工号!", vbOKOnly, "系统提示!"
Me.Text4.SetFocus
Exit Sub
End If
If Me.Text5.Text = "" Then
MsgBox "请输入密码", vbOKOnly, "系统提示!"
Me.Text5.SetFocus
Exit Sub
End If
UserID_Login = Me.Text4.Text
Password_Login = Me.Text5.Text
Me.Adodc1.Refresh
Do While Not Me.Adodc1.Recordset.EOF
If Me.Adodc1.Recordset.Fields("gonghao") = UserID_Login Then
Password_Login = Me.Adodc1.Recordset.Fields("mima")
If Me.Text5.Text <> Password_Login Then
MsgBox "密码不正确!", vbOKOnly, "系统提示!"
Me.Text4.Text = ""
Me.Text5.Text = ""
Me.Text4.SetFocus
Exit Sub
Else
frm_main.Show
Unload Me
End If
End If
Me.Adodc1.Recordset.MoveNext
Loop
MsgBox "无此用户,请重新输入!", vbOKOnly, "系统提示!"
Me.Text4.Text = ""
Me.Text5.Text = ""
Me.Text4.SetFocus
End Sub
运行后,提示下面的这一句 Me.Adodc1.Recordset.MoveNext 有误,
错误信息:
事实错误“91”
对象变量或with块变量未设置
------解决思路----------------------
打印出Adodc1.Recordset.recordcount是几?
debug.print Adodc1.Recordset.recordcount
------解决思路----------------------
同意!
------解决思路----------------------
select mima from 表名 where gonghao = UserID_Login
得到密码然后判断和输入的密码是否一致
你的问题在于用户命、密码一致的时候没有退出循环过程