This article describes the basic operation of the AddMenu macro action. For step-by-step instructions for creating custom menus and shortcut menus, see the article Create custom menus and shortcut menus by using macros.
You can use the AddMenu action to create:
- Custom menus on the Add-Ins tab for a particular form (form: An Access database object on which you place controls for taking actions or for entering, displaying, and editing data in fields.) or report (report: An Access database object that you can print, which contains information that is formatted and organized according to your specifications. Examples of reports are sales summaries, phone lists, and mailing labels.).
- A custom shortcut menu for a form, report, or control (control: A graphical user interface object, such as a text box, check box, scroll bar, or command button, that lets users control the program. You use controls to display data or choices, perform an action, or make the user interface easier to read.). The custom shortcut menu replaces the built-in shortcut menu for the form, report, or control.
- A global shortcut menu. The global shortcut menu replaces the built-in shortcut menu for fields in table and query datasheets, forms, and reports, except where you've added a custom shortcut menu for a form, report, or control.
Setting
The AddMenu action has the following arguments.
| Action argument |
Description |
| Menu Name |
The name of the menu, for example, "Report Commands" or "Tools". To create an access key (access key: A key combination, such as ALT+F, that moves the focus to a menu, command, or control, without using the mouse.) so that you can use the keyboard to choose the menu, type an ampersand (&) before the letter you want to be the access key. This letter will be underlined in the menu name on the Add-Ins tab.
|
| Menu Macro Name |
The name of the macro group (macro group: A collection of related macros that are stored together under a single macro name. The collection is often referred to simply as a macro.) that contains the macros for the menu's commands. This is a required argument.
Note If you run a macro containing the AddMenu action in a library database (library database: A collection of procedures and database objects that you can call from any application. In order to use the items in the library, you must first establish a reference from the current database to the library database.), Microsoft Office Access 2007 looks for the macro group with this name in the current database only.
|
| Status Bar Text |
The text to display in the status bar (status bar: A horizontal bar at the bottom of the screen that displays information about the current condition of the program, such as the status of items in the window, the progress of the current task, or information about the selected item.) when the menu is selected. This argument is ignored for shortcut menus. |
Remarks
To run the AddMenu action in a Visual Basic for Applications (VBA) module, use the AddMenu method of the DoCmd object. You can also set the MenuBar or ShortcutMenuBar property in VBA to create a custom menu on the Add-Ins tab or to attach a custom shortcut menu to a form, report, or control. You can set the ShortcutMenuBar property of the Application object to create a global shortcut menu.