Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Custom MenuBar code for non-admins

Status
Not open for further replies.

IndyCoder

MIS
May 30, 2006
21
US
I am attempting to load a custom menu bar when any non-admin user logs in. I have tried several things but I am not sure what I am missing right now. Here is the code I am using but it loads the CustomMenuBar for everyone.

Any help would be appreciated.

Code:
<html>
  <head>
    <title>Page</title>
  </head>
  <body>
    Private Sub Form_Load()
    
    'Maximize Access upon startup
    DoCmd.Maximize
    
  If UserInGroup = "Admins" Then
    Me.MenuBar = ""
  Else
    Me.MenuBar = "CustomMenuBar"
  End If
  
End Sub

  </body>
</html>

 
Code:
Public Sub usrtest()
    Dim usr As User
    Dim grp As Group
    
    Set usr = DBEngine(0).Users(CurrentUser)
    For Each grp In usr.Groups
        If grp.Name = "Admins" Then
            Me.MenuBar = ""
            Exit Sub
        End If
    Next grp
    Me.MenuBar = "CustomMenuBar"
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top