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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting Menu Bar Based on User Name 2

Status
Not open for further replies.

ScottXJ

Programmer
Aug 14, 2002
51
CA
Hello,

I have a function that obtains the user name of the current application user. For testing purposes, I have set the control source of an unbound text box to display the function results. What I would like to do is to make use of this function to apply some simple database security.

Basically, the breakdown of my requirement is as follows:

1. Use function to get user name and set variable to this value (I have this working)

2. Compare captured user name to static list of users.

3. Based on user name comparison, display appropriate menu.

I am familiar with how to capture the user name using an API call, but I am not sure how to get the application to display the appropriate menu. Also, does it make a difference if I would like to use the default menu as the other menu to be displayed or do I have to use two custom menus?

Any assistance would be appreciated.

Thanks,

Scott.
 
To show and hide menu bars, use DoCmd.ShowToolbar. The default menu bar is named "Menu Bar", and you can show it and hide it just like any custom menu bar.

One piece of advice: Show the default menu bar before terminating your application. If you don't, then when the user opens some other database, the menu bar will be hidden.

Rick Sprague
Want the best answers? See faq181-2886
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
 
You could try to use the Open/Load event of the form to check the current user and set the MenuBar property of the form:

Dim strMenuBarName as String
Select Case CurrentUser()
Case "Johnny"
strMenuBarName = "JohnnyBar"
Case "Billy"
strMenuBarName = "BillyBar"
Case Else
strMenuBar = "Menu Bar"
End Select

Me.MenuBar = strMenuBar


However, be aware that such a system cannot even remotely be called 'security'.

HTH


[pipe]
Daniel Vlas
Systems Consultant

 
Thanks very much Rick and Daniel for your quick responses. I understand that what I am looking to implement is very simplistic and not very secure, but it is for an initial release before moving the back-end of the database to SQL Server.

Regards,

Scott
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top