Hello everyone,
Here I am again seeking for your expert's advice.
In my database there are three roles namely
1. Accountant
2. Bookkeeper
3. Cashier
I have a Main Page Menu form with three buttons, specifically for the above mentioned roles.
My code goes like this:
Unfortunately Nothing Happens, meaning each roles can still access all three buttons.
But if My code is like this:
Then its working, for bookkeeper and the accountant.
may I know where did I go wrong?
For what I only want is to set a super user for the accountant, meaning having an access rights to all 3 cmdMenu buttons and setting the bookkeeper rights only at cmdMenu2 and Cashier at cmdMenu3.
Looking again forward to here from you.
Thank you and best regards.
Cheers!
Chino
VBA managing USER's Rights/Access
Here I am again seeking for your expert's advice.
In my database there are three roles namely
1. Accountant
2. Bookkeeper
3. Cashier
I have a Main Page Menu form with three buttons, specifically for the above mentioned roles.
My code goes like this:
Code:
Private Sub Form_Load()
txtUser.Value = strUser
txtRole.Value = strRole
txtFocus.SetFocus
'Set Enabled state of command button based on User Role
If strRole = "Accountant" Then
cmdMenu1.Enabled = True
cmdMenu2.Enabled = True
cmdMenu3.Enabled = True
ElseIf strRole = "Bookkepeer" Then
cmdMenu1.Enabled = False
cmdMenu2.Enabled = True
cmdMenu3.Enabled = False
ElseIf strRole = "Cashier" Then
cmdMenu1.Enabled = False
cmdMenu2.Enabled = False
cmdMenu3.Enabled = True
End If
End Sub
But if My code is like this:
Code:
Private Sub Form_Load()
txtUser.Value = strUser
txtRole.Value = strRole
txtFocus.SetFocus
'Set Enabled state of command button based on User Role
If strRole = "Accountant" Then
cmdMenu1.Enabled = True
Else
cmdMenu1.Enabled = False
End If
End Sub
may I know where did I go wrong?
For what I only want is to set a super user for the accountant, meaning having an access rights to all 3 cmdMenu buttons and setting the bookkeeper rights only at cmdMenu2 and Cashier at cmdMenu3.
Looking again forward to here from you.
Thank you and best regards.
Cheers!
Chino
0 commentaires:
Enregistrer un commentaire