Hello everyone,
I am sure this may be just a simple thing and may have been asked before. I found some solution to DLookup but I am not currently using DLookup so need to find another way. Below is the code I have behind BtnLogin to validate username and password. Right now it is not comparing for case sensitive when validating password. How can I achieve that.
here is the code
I am sure this may be just a simple thing and may have been asked before. I found some solution to DLookup but I am not currently using DLookup so need to find another way. Below is the code I have behind BtnLogin to validate username and password. Right now it is not comparing for case sensitive when validating password. How can I achieve that.
here is the code
Code:
Private Sub BtnLogin_Click()
Dim rs As Recordset
On Error GoTo Problem
'Check to see if data is entered into Username
If IsNull(Me.TxtUserID) Then
MsgBox "Please enter a UserID.", vbOKOnly, "Required Data"
Me.TxtUserID.SetFocus
Exit Sub
End If
'Check to see if data is entered into Password
If IsNull(Me.TxtPassword) Then
MsgBox "You must provide a password.", vbOKOnly, "Required Data"
Me.TxtPassword.SetFocus
Exit Sub
End If
'Lookup correct password for username entered in Username
Set rs = CurrentDb.OpenRecordset("TblUsers", dbOpenSnapshot, dbReadOnly)
rs.FindFirst "UserId='" & Me.TxtUserID & "'"
If rs.NoMatch = True Then
MsgBox "Incorrect User Name."
Me.TxtUserID.Value = ""
Me.TxtUserID.SetFocus
Exit Sub
End If
If rs!Password <> Nz(Me.TxtPassword, "") Then
MsgBox "Incorrect Password."
Me.TxtPassword.Value = ""
Me.TxtPassword.SetFocus
Exit Sub
End If