|
帮忙看看一段登陆代码,哪有错?谢谢了!
如下
Public Function login() As Boolean
Dim rs As New ADODB.Recordset
Dim strsql As String
strsql = "select 用户名,密码 from 密码库 where 用户名=" & Me.cb1user
rs.Open strsql, CurrentProject.Connection, adOpenStatic, adLockReadOnly
If rs.RecordCount > 0 Then
If rs("密码") = Me.TxtPwd Then
login = True
End If
End If
rs.Close
Set rs = Nothing
End Function
Private Sub cmdok_click()
If IsNull(Me.cb1user) Then
MsgBox "输入用户名!", vbCritical
Exit Sub
Else
Me.cb1user.SetFocus
p_username = Me.cb1user.text
End If
If login = True Then
username = Me.cb1user.text
DoCmd.Close
DoCmd.OpenForm "主窗体"
Else
MsgBox "您输入的密码错误,请重新输入,仅三次!", vbCritical
Exit Sub
End If
End Sub
Private Sub cmdCancel_Click()
DoCmd.Quit acQuitSaveNone
End Sub
Private Sub cbouser_notinlist(newdata As String, response As Integer)
response = acDataErrContinue
End Sub
总说至少一个参数没被指定,然后rs.Open strsql, CurrentProject.Connection, adOpenStatic, adLockReadOnly这句话就变黄了,谁能教教我怎么改啊?谢谢了,高手们! |
|