Menus visible dependent on user

Blackwidow

Registered User.
Local time
Today, 01:34
Joined
Apr 30, 2003
Messages
149
I have created my own menus to navigate round the database. However I'm a little stuck as different user groups can only have access to certain menus.. Is it possible that you can hide menus dependant on the user logged in the database.

I.e. Leadership get full menus

General Staff only get access to All Staff Menu all others Disabled?
 
When you say Menu, do you mean Switchboard?

or do you mean MenuBar.
To change Menubar of form use, Me.MenuBar = "NoEdit"

For switchBoard, just disable cmdbutton to take you there?

SElect Case CurrentUser
Case "Joe", "Nancy", "Peter", "Bob", "Gerry"
cmdFullMenu.Enabled = False
Case Else
cmdFullMenu.Enabled = True
End SElect
 
Help!!

I cant get it to work and its doing my head in!!

I am talking about Menubars yes i have tried this code behind the main form:

Private Sub Form_Load()
If CurrentUser = "staff" Or CurrentUser = "STAFF" Then
DoCmd.ShowToolbar "The College High School Menubar", acToolbarNo
Else
DoCmd.ShowToolbar "The College High School Menubar", acToolbarYes
End If
End Sub

but it keeps coming up that it menubar name is wrong??


Or is there a way to password protect the menus?
 
Do you have these "Toolbars", as Toolbars or MenuBars.
From the properties, tab from the Custom Dialog.

Your property for each, may be wrong?

Or try the Me.Menu Method?
 
Hide menus dependant on users

Hi,

using some help in the code acrhive...
http://www.access-programmers.co.uk/forums/showthread.php?t=97578

I use this to hide or unhide menu's for different users...

Code:
Private Sub Form_Load()

'hide toolbars/menu/rightclick
Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars(i).Enabled = False
Next i

'Hide maindb window
DoCmd.SelectObject acTable, , True
DoCmd.RunCommand acCmdWindowHide

'only show 1 taskbar window
Application.SetOption "ShowWindowsinTaskbar", False

If CurrentUser = "Admin" Then
Dim ii As Integer
For ii = 1 To CommandBars.Count
CommandBars(ii).Enabled = True
Next ii

'unhide Maindb window
DoCmd.SelectObject acTable, , True

End If

End Sub

Either stick it in an autoloading form or use a autoexec to load it

I hope this makes sense if not PM me and I'll send u and example...

Mike

May not be pretty but it works...
:D
 
> i am talking about menu bar
> i have use this code in a module to disable the new control in file menu
> Application.CommandBars("FILE").Controls("NEW...").Enabled = False

> i want to disable/hide the control which shows the path of .mdb file.
> you can see it in file menu, its before the " EXIT " control/cmd.


>
When you say Menu, do you mean Switchboard?


or do you mean MenuBar.
To change Menubar of form use, Me.MenuBar = "NoEdit"

For switchBoard, just disable cmdbutton to take you there?

SElect Case CurrentUser
Case "Joe", "Nancy", "Peter", "Bob", "Gerry"
cmdFullMenu.Enabled = False
Case Else
cmdFullMenu.Enabled = True
End SElect
 
Re: Hide menus dependant on users

i have created 2 user group , one is admin and another is regular.
i have done everything to restrict regular user for accessing database window.
but in file menu when we clk the path of .mdb file ( its before the exit cmd/control). it opens the databaes window.
i want to hide/disable this cmd/control.
as i did for other cmd/controls of file menu. example code is

Application.CommandBars("FILE").Controls("NEW...").Enabled = False
but i dont know how to do it for this cmd/control
Hi,

using some help in the code acrhive...
http://www.access-programmers.co.uk/forums/showthread.php?t=97578

I use this to hide or unhide menu's for different users...

Code:
Private Sub Form_Load()
 
'hide toolbars/menu/rightclick
Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars(i).Enabled = False
Next i
 
'Hide maindb window
DoCmd.SelectObject acTable, , True
DoCmd.RunCommand acCmdWindowHide
 
'only show 1 taskbar window
Application.SetOption "ShowWindowsinTaskbar", False
 
If CurrentUser = "Admin" Then
Dim ii As Integer
For ii = 1 To CommandBars.Count
CommandBars(ii).Enabled = True
Next ii
 
'unhide Maindb window
DoCmd.SelectObject acTable, , True
 
End If
 
End Sub

Either stick it in an autoloading form or use a autoexec to load it

I hope this makes sense if not PM me and I'll send u and example...

Mike

May not be pretty but it works...
:D
 
Hi,

Im not sure I know what you mean, if the code is running on startup this should hide the main DB window and only allow the Switchboard to load.

Mike
 

Users who are viewing this thread

Back
Top Bottom