Hi All,
I have adopted a code for my startup login form of my database made in Access 2010.
When I run the form with below said code. insert username and password It does not accepts password. I have tried changing password and carefully put up again. but not accepting the password. what I am missing ? Please advise.
Private Sub Cmd_Login_Click()
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 rstuserpwd![UserName] = Form_FrmLogin.TxtUserName.Value And rstuserpwd![Password] = Form_FrmLogin.TxtPassword.Value Then
bfoundmatch = True
Exit Do
End If
rstuserpwd.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 Audit Form"
Else
'
MsgBox "Incorrect Password. Please Try Again"
End If
rstuserpwd.Close
End Sub