The AddMenu action can be used to:
The AddMenu action uses the following arguments.
Action argument | Description |
Menu Name | The name of the drop-down menu to add to the custom menu bar or global menu bar. This is a required argument for custom menu bars and global menu bars. This argument is ignored for custom shortcut menus and global shortcut menus. |
Menu Macro Name | The name of the macro group that contains the macros for the menus commands. This is a required argument. |
If you run a macro containing the AddMenu action in a library database, Microsoft Access looks for the macro group with this name in the current database only. | |
Status Bar Text | The text to display in the status bar when the menu is selected. This argument is ignored for custom shortcut menus and global shortcut menus. |
To create a custom menu bar, a custom shortcut menu, a global menu bar, or a global shortcut menu, you must do the following:
Tip You can use the Menu Builder to create any of the custom or global menu bars and shortcut menus by clicking the Build button next to the property box or Startup dialog option box where you specify the menu bar macro. The Menu Builder creates and names the menu bar macro and the macro groups containing the actions for the menu commands and subcommands on the menu you create. If you use the Menu Builder to create the menu bar macro and the macro groups for the menus, you can also use the Menu Builder to edit these macros and macro groups.
However, if you create the custom menu bar or custom shortcut menu in the Macro window, you cant use the Menu Builder to edit the menu bar macro and macro groups because the Menu Builder places restrictions on the names it uses for the menu bar macro and macro groups, and on the kinds of actions it uses in the macros.
For global shortcut menus and custom shortcut menus, add only one menu in the Menu Builder. Any additional menus are ignored.
Each menu on the menu bar requires a separate AddMenu action.
The custom and global menu bars and shortcut menus replace the built-in menu bars and shortcut menus for the objects theyre attached to. If you want to retain certain Microsoft Access commands to use on these menus, use the DoMenuItem action to put the commands into the macro groups for the desired menus.
You can run a macro from a menu command by using the RunMacro action in the macro for the command.
Note AddMenu actions can be used only in a menu bar macro specified by the MenuBar or ShortcutMenuBar property of a form, form control, or report, or by the Menu Bar box or Shortcut Menu Bar box in the Startup dialog box, available by clicking Startup on the Tools menu. Menu bar macros should contain only AddMenu actions.
You can create a submenu for a custom menu or a custom shortcut menu by using the AddMenu action in a macro group specified by the Menu Macro Name argument. If you put an AddMenu action in such a macro group, Microsoft Access creates a submenu with the menu name and status bar text specified by the Menu Name and Status Bar Text arguments for this AddMenu action. The submenu contains the commands defined by the macros in the macro group specified by the Menu Macro Name argument for the AddMenu action. The Menu Name and Status Bar Text columns of such an AddMenu action are ignored, since this action defines a submenu, not a command on the top-level menu. You can create multiple levels of submenus by using AddMenu actions in the macro groups for each level of menu.
Macro conditions are supported in the top-level menu bar macro only. In other words, you can use a condition in a menu bar macro to determine if a particular menu will be displayed on the custom menu bar or global menu bar, but only for the menus on the top level of the menu bar. You cant use conditions to display or hide commands or submenus on the menus. You can also use a condition to hide or show a custom shortcut menu or global shortcut menu.
Note In Microsoft Access version 2.0, if you used the AddMenu action to put the Add-Ins submenu on the File menu of a custom menu bar, Microsoft Access automatically added the appropriate Add-Ins submenu items to your custom menu. In Microsoft Access for Windows 95, the Add-Ins submenu has moved to the Tools menu. Microsoft Access adds the submenu items to this menu as before. However, it will not add the submenu items to an Add-Ins submenu on the File menu of a custom menu bar or global menu bar. If you had an Add-Ins submenu on one or more of your custom menu bars in version 2.0, you may want to rewrite your macros and move the Add-Ins submenu to the Tools menu.
The AddMenu action isnt available in Visual Basic. You can, however, set the MenuBar or ShortcutMenuBar property in Visual Basic to attach a custom menu bar or custom shortcut menu to a form, form control, or report. You can set the StartupMenuBar property (the programmatic equivalent of setting the Menu Bar box) to create a global menu bar. You can also set the MenuBar property of the Application object to create a global menu bar. Similarly, you can set the StartupShortcutMenuBar property (the programmatic equivalent of setting the Shortcut Menu Bar box) or the ShortcutMenuBar property of the Application object to create a global shortcut menu.
Application Object, Event Properties, MenuBar Property, ShortcutMenuBar Property, StartupMenuBar Property, StartupShortcutMenuBar Property.