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

Please help to Create Menu items

Status
Not open for further replies.

patiya

MIS
Nov 24, 2003
23
0
0
US
Hi there,

I am designing a new Access 2003 database, hoping to migrate into ADP in the near future. I would like to create separate menu items like Access (such as File, Edit, View etc). And each of the menu items will have drop down menu pads (Ex. File Menu items have: New, Open etc).

What I really want to accomplish is the following: There will be initial login screen Form for all users. I already designed the form. After successful login and depending on Users Rights (I already have a user table, with a field name "Rights", have 3 Values: "Users", "Manager","Admin") they will have access to assigned menu Items. Rest will be dimmed out. After selecting the separate menu pads (On Click Event) from the menu Items, appropriate form will open. Also within the same menu items, certain users will have rights to separate menu pads. Rest will be dimmed out.

Currently I have switch boards, but problem with that switch board sub-items does not display like pull down menu items. Users some time get confused to select which switch board items to select to get into another sub-items. Atleast that is what is my understanding. I may be wrong.

I would appreciate any help in this issue or any URL Link to any sample database to accomplish this task will be highly appreciated.

Sincerely

Patiya
 
To create a custom menubar, simply right click on an existing menu bar and select Customize... from the drop down list, and name the toolbar whatever you want. Then drag whatever items you want onto the toolbar. At some point, select Properties from the Custom Dialog box and change the toolbar to a menubar.

Now, suppose your menubar was named MyMenuBar and suppose your menubar contains File, Edit, View and you want to disable View. Then enter something like this

CommandBars("MyMenuBar").Controls("View").Enabled = False
 
Just a few suggestions, based on the many apps I have set up.

1. If a user does not have the rights to select a button on a menu, make the button not visible, rather than dimming it. Why have temptation? I don't know if you can set a visible property to a commandbar control, but if so I would do it for that if you decide to stay with the menu bars.

2. Have your navigation controlled through forms, rather than the Access menu. That is more easily understood by users and you also have more room (on a form) to include some short directions or guidance than on a drop down menu.
 
Thanks Fancy and Bisman,

Bisman,

I like the Idea that you mentioned in #2. I think it is more flexible. But I only know how to create Custom Menu Bars using Access Tutorial. I do not know how to create Navigation controls or Create Menu bars in Form. If you have some tutorial or sample examples that you can send, I will appreciate very much.

Ps. Another way of doing is using Switch board but the disadvantage with this approch is that users need to remember each selection #'s or steps to reach the appropriate sub-selection. Also unlike drop down menu bars, they are not visible to users in the 1st screen.

Sincerely

Patiya
 
On each form (such as your main menu form), have a button for each item. I usually name these buttons with the prefix "cmd". For each button you can either use the wizard, or, even better, write the simple code I've listed below for the "OnClick" property of the button.

Let's assume a form with four buttons:
"Add" (cmdAdd) (set visible to false)
"Edit" (cmdEdit) (set visible property to false)
"View" (cmdView) (set visible property to true)
"Exit" (cmdExit) (set visible property to true)

For the form's OnOpen property, use the user's rights to set the visible function of cmdAdd and cmdEdit as appropriate for the user's rights.

As an example for the add button, let's assume that you are going to open a form called "frmAddData". In the design mode of the form, for the OnClick property of the control (button) cmdAdd, write the following VBA code:

docmd.Close
docmd.OpenForm("frmAddData")

The first line will close the menu form (I normally avoid leaving more than one form open at a time except for special circumstances).

The second line opens the form frmAddData.

Using this type of navigation in your application creates a cleaner application interface as well as an application that you can more easily support, particularly if you use names of controls, forms, etc., that give a reasonable idea of their function.

Bob
 
Patiya,

I have created a "menu" based system using an approach similar to BSman's. I've used label boxes for the menubar and buttons for the dropdown menus. When the user logs in the permissions are used to set the enabled status of each button as appropriate. In Code I've created a "menu manager" and each dropdown list has it's own routine that turns the buttons on or off depending on which menu has been selected. Works pretty well.

Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top