Hi,
I have database with Multiuser login system with different user roles.
1) Main Page or Dashboard has navigation buttons to open different forms.
2) One one the different forms (Name: MainOrderEntriesSheet), I have blocked for certain user level by following code.
Now, if user level 1, clicks on that form it does not open. So the code works well, by direct click on that form.
PROBLEM:
the same user can open that form on Navigation button of navigation form.
By 1st Click, message " Access denied......" appears , but then form opens up in the navigation page, which is blocked otherwise.
It tried to use the same code on Navigation button click, it does not work.
I am new to this , and need help.
Regards
I have database with Multiuser login system with different user roles.
1) Main Page or Dashboard has navigation buttons to open different forms.
2) One one the different forms (Name: MainOrderEntriesSheet), I have blocked for certain user level by following code.
Code:
Private Sub Form_Click()
Dim UserLevel As Integer
UserLevel = DLookup("UserRoles", "Users", "UserIDD = '" & Me.textUser.Value & "'")
If UserLevel = 1 Then
DoCmd.Close acForm, "MainOrderEntriesSheet", acSaveNo
End If
End Sub
Private Sub Form_Load()
Dim UserLevel As Integer
UserLevel = DLookup("UserRoles", "Users", "UserIDD = '" & Me.textUser.Value & "'")
If UserLevel = 1 Then
MsgBox "Access Denied, Please contact System Administrator", vbCritical, "Not Allowed"
DoCmd.Close acForm, "MainOrderEntriesSheet", acSaveNo
End If
End Sub
Now, if user level 1, clicks on that form it does not open. So the code works well, by direct click on that form.
PROBLEM:
the same user can open that form on Navigation button of navigation form.
By 1st Click, message " Access denied......" appears , but then form opens up in the navigation page, which is blocked otherwise.
It tried to use the same code on Navigation button click, it does not work.
I am new to this , and need help.
Regards