My experience with menus has been with Visual C++ and Visual Basic. Both Visual Basic and Visual C++ have wizards to help the developer easily create menu items and subitems attaching code for onclick events. Access 2000, on the other, unfortunately does not. But the good news is that Access 2000 menus are easy to create once you understand the necessary manual steps. This article will walk you step by step through creating a menu.
Create Your Application Menu
- Click "View", "Toolbars", "Customize".
Customize has three tab buttons: toolbars, commands, and options.
- From the toolbars tab, click on the "new" button.
- A popup dialog box will appear requesting a toolbar name; enter "myApplicationMenu".
- A menu dialog will appear.
Create your Macros for Application Forms and Reports
- Create Macros for forms and reports next as the menu items or submenu items will run these macros.
- Use either OpenForm or OpenReport and initialize the command with the form name.
Adding Menu Items
- Click the "Commands" tab from the Customize Dialog.
- The Commands tab has two listboxes: Categories and Commands. The order of operation
requires you to select a category and drag and drop a command into the menu dialog.
- Let's do this. Click Category: File and Command: Custom. Hold the right mouse button down
and drag and drop the command into the menu dialog. You'll notice a menu item name "custom" appears.
- Change the Menu name by right clicking on the menu item. A popup dialog will appear;
change the name to a form or report name. Another way to make the name change is to select the properties item.
- The properties dialog has the following textboxes:
Caption: The display information of the menu item.
ScreenTip: On hover tooltip.
OnAction: Select the macro of the form or report you want to launch on a Onclick event.
Style: Text Only or Image and Text.
HelpFile: The filename of the helpfile.
HelpContextId: Context Sensitive help.
Parameter: Value passed by the menu item.
Tag: Information that can be used later in the procedure event.
This requires dragging and dropping two category types: new menu and file categories.
The new menu creates a parent menu item and the file category creates submenu types.
This is a little tricky, so hopefully my steps will be clear enough for you to accomplish this task.
- Select new menu from the categories and then new menu from the command.
- Drag and Drop the menu item onto the menu dialog.
- Select file from the categories and then select custom from the command.
- Drag and Drop the submenu item onto the "New menu" item. The trick is not to drop
the submenu item onto the menu item, but to instead put it in the drop down box below the menu item.
This seems simple, but it initially took me about five minutes to figure that out.
- Using the properties popup, change the menu and submenu names and OnAction events.
- Close the Customize Dialog.
- Drag and Drop the menu dialog onto the toolbar.
Activitating or Deactivitating Custom Menus
That's it! Hope you found this walkthrough helpful and instructive.
- The custom dialog is used to activate or deactivate toolbar menus.
- The custom menu must be open in order to change menu items through the properties dialog.
Back to Access 2000 How To's Series Home