im trying to create a login form and after much research ive gotten this far except i keep getting the above error.
on click of my login button:
Dim dbs As Database
Dim rstUserPwd As Recordset
Dim bfoundMatch As Boolean
Set dbs = CurrentDb
Set rstUserPwd = dbs.OpenRecordSet("qryUserPwd")
bfoundMatch = False
If rstUserPwd.RecordCount > 0 Then
rstUserPwd.MoveFirst
' check for matching records
Do While rstUserPwd.EOF = False
If rstUserPwrd![UserName] = Form_Login.txtusername.Value And rstUserPwrd![Password] = Form_Login.txtpassword.Value Then
bfoundMatch = True
Exit Do
End If
rstUserPwrd.MoveNext
Loop
End If
If bfoundMatch = True Then
'Open the next form here and close this one
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "Main"
Else: MsgBox "Incorrect Username and or Password"
End If
can anyone please point out what im doing incorrectly please
on click of my login button:
Dim dbs As Database
Dim rstUserPwd As Recordset
Dim bfoundMatch As Boolean
Set dbs = CurrentDb
Set rstUserPwd = dbs.OpenRecordSet("qryUserPwd")
bfoundMatch = False
If rstUserPwd.RecordCount > 0 Then
rstUserPwd.MoveFirst
' check for matching records
Do While rstUserPwd.EOF = False
If rstUserPwrd![UserName] = Form_Login.txtusername.Value And rstUserPwrd![Password] = Form_Login.txtpassword.Value Then
bfoundMatch = True
Exit Do
End If
rstUserPwrd.MoveNext
Loop
End If
If bfoundMatch = True Then
'Open the next form here and close this one
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "Main"
Else: MsgBox "Incorrect Username and or Password"
End If
can anyone please point out what im doing incorrectly please