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:
[COLOR=#0000FF !important]Private [COLOR=#0000FF !important]Sub[/COLOR] LogonBtn_Click()
[COLOR=#0000FF !important]Dim[/COLOR] ID [COLOR=#0000FF !important]As[/COLOR] [COLOR=#0000FF !important]Long[/COLOR], PW [COLOR=#0000FF !important]As[/COLOR] [COLOR=#0000FF !important]String[/COLOR], SL [COLOR=#0000FF !important]As[/COLOR] [COLOR=#0000FF !important]String[/COLOR]
ID = Nz(DLookup([COLOR=#E29232 !important]"UserID"[/COLOR], [COLOR=#E29232 !important]"UserT"[/COLOR], [COLOR=#E29232 !important]"Username="""[/COLOR] & Username & [COLOR=#E29232 !important]""""[/COLOR]), [COLOR=#C92C2C !important]0[/COLOR])
[COLOR=#0000FF !important]If[/COLOR] ID = [COLOR=#C92C2C !important]0[/COLOR] [COLOR=#0000FF !important]Then[/COLOR]
MsgBox [COLOR=#E29232 !important]"User not found"[/COLOR]
Quit
[COLOR=#0000FF !important]End[/COLOR] [COLOR=#0000FF !important]If[/COLOR]
PW = Nz(DLookup([COLOR=#E29232 !important]"Password"[/COLOR], [COLOR=#E29232 !important]"UserT"[/COLOR], [COLOR=#E29232 !important]"UserID="[/COLOR] & ID), [COLOR=#E29232 !important]""[/COLOR])
[COLOR=#0000FF !important]If[/COLOR] PW <> Password [COLOR=#0000FF !important]Then[/COLOR]
MsgBox [COLOR=#E29232 !important]"Incorrect Password"[/COLOR]
Quit
[COLOR=#0000FF !important]End[/COLOR] [COLOR=#0000FF !important]If[/COLOR]
SL = Nz(DLookup([COLOR=#E29232 !important]"SecurityLevel"[/COLOR], [COLOR=#E29232 !important]"UserT"[/COLOR], [COLOR=#E29232 !important]"UserID="[/COLOR] & ID), [COLOR=#E29232 !important]""[/COLOR])
[COLOR=#0000FF !important]If[/COLOR] SL <> SecurityLevel [COLOR=#0000FF !important]Then[/COLOR]
MsgBox [COLOR=#E29232 !important]"Access Denied"[/COLOR]
Quit
[COLOR=#0000FF !important]End[/COLOR] [COLOR=#0000FF !important]If[/COLOR]
TempVars([COLOR=#E29232 !important]"SecurityLevel"[/COLOR]) = SecurityLevel.Value
DoCmd.OpenForm [COLOR=#E29232 !important]"MainMenuF"[/COLOR]
DoCmd.Close acForm, [COLOR=#0000FF !important]Me[/COLOR].Name, acSaveYes
[/COLOR]