DoCmd.AddMenu method (Access)
The AddMenu method carries out the AddMenu action in Visual Basic.
Syntax
expression.AddMenu (MenuName, MenuMacroName, StatusBarText)
expression A variable that represents a DoCmd object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
MenuName | Required | Variant | A string expression that's the valid name of a drop-down menu to add to the custom menu bar or global menu bar. To create an access key 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 menu bar. |
MenuMacroName | Required | Variant | A string expression that's the valid name of the macro group that contains the macros for the menu's commands. This is a required argument. |
StatusBarText | Required | Variant | A string expression that's the text to display in the status bar when the menu is selected. |
Remarks
Use the AddMenu action to create a:
Custom menu bar for a form or report. The custom menu bar replaces the built-in menu bar for the form or report.
Custom shortcut menu for a form, form control, or report. The custom shortcut menu replaces the built-in shortcut menu for the form, form control, or report.
Global menu bar. The global menu bar replaces the built-in menu bar for all Microsoft Access windows, except where you've added a custom menu bar for a form or report.
Global shortcut menu. The global shortcut menu replaces the built-in shortcut menu for fields in table and query datasheets, forms in Form view, Datasheet view, and Print Preview, and reports in Print Preview, except where you've added a custom shortcut menu for a form, form control, or report.
You must include the MenuName and MenuMacroName arguments in the AddMenu method for custom menu bars and global menu bars. The MenuName argument is not required and will be ignored for custom shortcut menus and global shortcut menus.
The StatusBarText argument is optional; this argument is ignored for custom shortcut menus and global shortcut menus.
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기