We have 10 users in our Ms Access application and each is given specific rights by using VBA as below, for example managerial rights:
Private Sub Form_Open(Cancel As Integer)
Dim strITManager As String
strITManager = "Managers"
If Forms!frmLogin!txtUserrights.Value <> [strITManager] Then
MsgBox "You are not authorized to open this form!", vbOKOnly + vbExclamation, "Rights Not Granted"
Cancel = True
The above method works very well with the current XML ribbon, but each and every users will have a chain of buttons which they cannot use or denied access, so instead of using the above VBA I want to hide those buttons that are not required by certain users using a better method if there is any. The challenge here is that I’m using an XML ribbon I do not know whether that can work here, below is a sample:
<button id="PosDelPurchases" imageMso="MasterViewClose" onAction="PosDelPurchases" label="Delete Wrong Purchases" showImage="true"/>
The above ribbon uses the macros as follows:
(1) Macro name = PosDelPurchases (onAction="PosDelPurchases")
So in short what I want to hide here is the button id (PosDelPurchases) and the label (label="Delete Wrong Purchases") but authorized users should be allowed to see them.
If the above can work then the software can be easy to use because users will have specific buttons to see and use.
Option available: Since I have seven modules as below could it be okay to create specific ribbons per module and then implement the restrictions at VBA level:
(2) Sales Accounting
(3) Purchases Accounting
(4) Financial accounting