Create Menus in Access 2000 (Article)


Author: David Nishimoto

Version Compatibility: Visual Basic 6

Instructions: Copy the declarations and code below and paste directly into your VB project.

David Nishimoto

Article: How to Create menus using Access 2000

Overview of Menus: My experience with menus has been with Visual C++ and Visual Basic. Both Visual Basic and Visual C++ have wizards helping the developer easily create menu items and subitems attaching code for onclick events. However, Access 2000 does not. Access 2000 menus are easy once you understand the manual steps. This article will walk you step by step through creating an menu.

Creating the your application_menu

1. Click "View", "Toolbars", "Customize"

Customize has three tab buttons: toolbars, commands, and options

2. From the toolbars tab press the "new" button
3. A popup dialog box will appear requesting a toolbar name, enter "myApplicationMenu"
4. A menu dialog will appear

Create your macros your Application Forms and Reports

1. Create Macro for forms and reports now because the menu items or submenu items will run these.
2. Use either OpenForm or OpenReport and initialize the command with the form name.

Adding Menu Items

1. Click the "commands" tab from the Customize Dialog
2. 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 on the menu dialog.
3. Lets do it.  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.
4. Change the Menu name, by right clicking over the menu item.  A popup dialog will appear, 
change the name to a form or report name.   Support the forms name is, "ABC Form".  The name 
now will have "ABC Form".  Another way to make the name change is to select the properties item.
5. The properties dialog has the following textboxes:
	Caption:  The display information of the menu item
	ScreenTip:  On hoover 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

Adding Submenus

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 create submenu types.
This is a little tricky so hopefully my steps will be clear enough for you to accomplish this task.

1. Select new menu from the categories and new menu from the command.
2. Drag and Drop the menu item onto the menu dialog
3. Select file from the categories and custom from the command
4. 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 put is in the drop down box below the menu item.  
This seems simple, but it took me about five minutes to figure that out.
5. Using the properties popup change the menu and submenu names and OnAction events.
6. Close the Customize Dialog
7. Drag and Drop the menu dialog onto the toolbar.

Activitating or DeActivitating custom menus

1. The custom dialog is used to activate or deactivate toolbar menus.
2. The custom must be open in order to change menu items through the properties dialog.