I have set my code on my logon button, it keeps telling me that the Security Level has not been defined as a variable.
VBA Code:
Private Sub LogonBtn_Click()
Dim ID As Long, PW As String, SL As String
ID = Nz(DLookup("UserID", "UserT", "Username=""" & Username & """"), 0)
If ID = 0 Then
MsgBox "User not found"
Quit
End If
PW = Nz(DLookup("Password", "UserT", "UserID=" & ID), "")
If PW <> Password Then
MsgBox "Incorrect Password"
Quit
End If
SL = Nz(DLookup("SecurityLevel", "UserT", "UserID=" & ID), "")
If SL <> SecurityLevel Then
MsgBox "Access Denied"
Quit
End If
TempVars("SecurityLevel") = SecurityLevel.Value
DoCmd.OpenForm "MainMenuF"
DoCmd.Close acForm, Me.Name, acSaveYes