restrict ribbon tabs to users

bigmac

Registered User.
Local time
Yesterday, 23:15
Joined
Oct 5, 2008
Messages
302
hi all, can you help please , I want to restrict the users to only be able to access certain tabs in the ribbon .
example "user1" cannot access the external tab and the create tab, but can access all others , can you help please?:confused:
 
Do you have any security built into your db? Here is an Example:
Unable to provide more help without further info.


' If tab page with Tab Index of 1 is selected
' show InputBox asking for password
If TabCtl0.Value = 1 Then
strInput = InputBox("Please enter a password to access this tab", _
"Restricted Access")

' Check if value is entered into InputBox
' If no value entered display MsgBox
If strInput = "" Or strInput = Empty Then
MsgBox "No Input Provided", , "Required Data"
TabCtl0.Pages.Item(0).SetFocus
Exit Sub
End If
 
Do you have any security built into your db? Here is an Example:
Unable to provide more help without further info.

the user has to login with his password , each has their own 1ngEmpID, I want to on load use the 1ngEmpID to restrict the user ,
example, if 1ngEmpID = 1 then (restrict tabs )
its the restrict tabs bit I am stuck on, how di I do this ? and how do I just restrict certain tabs?
 
Again, using your security setup you can enable/disable the tabs according to their privileges. Example:

Private Sub Form_Current()

If (Me.[1ngEmpID].Value) = -1 Then
Me.TabCtl0.Pages.Item(0).Enabled = False
ElseIf (Me.[1ngEmpID].Value) = 1 Then
Me.TabCtl0.Pages.Item(0).Enabled = True
End If

I think a better approach to this is to set form permissions with a Case Statement and a Global Variable called via a Module.
 
Last edited:
hi burrina, tried this but kept getting compile error, method or date member not found,
you say a better way would be form permissions and a global variable , I am not sure how to do this , can you show me an example please?
 
I still don't know how your security setup is, but here is an Example: Also, you did not say what error you got and on what line of code, not enough details provided!

Module;
modGlbVar
Option Compare Database
Option Explicit

Public strSecLvl As String ' User's Security Level

tblUserSecurity
userID Text No Duplicates
admn Yes/No

'Set User Level Security.
'On Form Open

Select Case (strSecLvl)
Case "Administrator"
'Set appropriate form properties for Administrator
Me.AllowAdditions = True
Me.AllowEdits = True
Me.AllowDeletions = True

Case Else
MsgBox "The user name with which you have logged in " & _
"is not cleared for access to this screen." & vbCrLf & vbCrLf & _
"Please check your security settings.", vbCritical, "Security Error !"


End Select


Good Luck!
 
hi burrina, I have a option explicit set up (this is the 1ngEmpID)
I have tried the
If lngMyEmpID = 1 Then
Me.AllowAdditions = false
Me.AllowEdits = false
Me.AllowDeletions = false
all this does is stop the user from adding, editing, deleting anything on the form .
does not stop them using the ribbon tabs (create, database tools etc)
the error code is on line "Me.TabCtl0.Pages.Item(0).Enabled = False"(highlighted in red)
not sure if I am supposed to insert anything else into this line where the zeros are?
is there a number to correspond to each tab? if so where do I find this please?
by the way thank you for your patients , I am a slow learner
 
As I said, I don't think this is the best option, however if in design mode you right click on the Tab Control you will see that it has Page Numbers, you need to refer to the correct Page Number for it to work.
 
burrina, I think we have crossed wires , the tabs I am on about are the tabs in the main ribbon (home , create external data, etc. ),these are the tabs I want to restrict not the tabs in a tabbed form does this help?
 
I don't use ribbons so maybe someone else can help. Or Search on this forum or Google it.
Good Luck!
 

Users who are viewing this thread

Back
Top Bottom