i have a login form which logs in perfectly but i recently noticed that it still logs the user in without considering the case sensitivity of the password.
Would be glad if someone could be of help.
This is the code behind my login button on the form
"Dim FIRST_NAME As Variant, access_level As Variant
If Trim(Me.txt_username.Value & vbNullString) = vbNullString Then
MsgBox prompt:="Username should not be left blank.", buttons:=vbExclamation, title:="SYSTEM"
Me.txt_username.SetFocus
Exit Sub
End If
If Trim(Me.txt_password.Value & vbNullString) = vbNullString Then
MsgBox prompt:="Password should not be left blank.", buttons:=vbExclamation, title:="SYSTEM"
Me.txt_password.SetFocus
Exit Sub
End If
' RETREIVE FROM SAVED QUERY
' ASSUMES EVERY USER GIVEN A NON-NULL ACCESS LEVEL
FIRST_NAME = DLookup("FirstName", "tbl_login", "UserName = '" & Me.txt_username & "' and password = '" & Me.txt_password & "'")
access_level = DLookup("access_level", "tbl_login", "UserName = '" & Me.txt_username & "' and password = '" & Me.txt_password & "'")
If IsNull(FIRST_NAME) = True Then
MsgBox prompt:="Incorrect username/password. Try again.", buttons:=vbCritical, title:="SYSTEM"
Me.txt_username.SetFocus
Else
MsgBox prompt:="Welcome, " & FIRST_NAME & ".", buttons:=vbOKOnly, title:="SYSTEM"
'arnelgp
'save the first_name and access_level to Tempvars
TempVars("First_Name") = FIRST_NAME
TempVars("Access_Level") = access_level
TempVars("user") = Me.txt_username.Value
' CONDITIONALLY OPEN FORMS
Select Case access_level
Case "Administrator"
DoCmd.OpenForm "ABC"
Case "Accounts"
DoCmd.OpenForm "XYZ"
End Select
End If