I have a login form which remains open but not visible after successful login. On that form I have a hidden text box "txtSecLevel" which indicates the security level of the employee signing in.
I have a main menu form "frmMainMenu", with buttons to open the forms, which runs an IF statement to check security level before opening the requested form. I am having problems with the IF statement. It doesn't seem to be working since the current employee logged in on frmLogin has a security level of 1 and the form should not open but it does.
I am probably missing a small piece of info but can't seem to figure it out. I am using Access 2007 on Windows 7. The code behind the button on frmMainMenu is as follows:
Private Sub butPriTask_Click()
If Forms!frmLogin!txtSecLevel = 2 Or 3 Then
DoCmd.OpenForm "frmPrimaryTask", acNormal, "", "", , acNormal
Else
MsgBox "You are not authorized to access this form!", vbOKOnly
End If
End Sub
Thanks in advance for the assistance.
I have a main menu form "frmMainMenu", with buttons to open the forms, which runs an IF statement to check security level before opening the requested form. I am having problems with the IF statement. It doesn't seem to be working since the current employee logged in on frmLogin has a security level of 1 and the form should not open but it does.
I am probably missing a small piece of info but can't seem to figure it out. I am using Access 2007 on Windows 7. The code behind the button on frmMainMenu is as follows:
Private Sub butPriTask_Click()
If Forms!frmLogin!txtSecLevel = 2 Or 3 Then
DoCmd.OpenForm "frmPrimaryTask", acNormal, "", "", , acNormal
Else
MsgBox "You are not authorized to access this form!", vbOKOnly
End If
End Sub
Thanks in advance for the assistance.