DoCmd.SetMenuItem method (Access)
The SetMenuItem method carries out the SetMenuItem action in Visual Basic.
Syntax
expression.SetMenuItem (MenuIndex, CommandIndex, SubcommandIndex, Flag)
expression A variable that represents a DoCmd object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
MenuIndex | Required | Variant | An integer, counting from 0, that is the valid index of a menu on the custom menu bar or global menu bar for the active window, as defined in the menu bar macro for the custom menu bar or global menu bar. If you select a menu with this argument and leave the CommandIndex and SubcommandIndex arguments blank (or set them to 1), you can enable or disable the menu name itself. You can't, however, check or uncheck a menu name (Microsoft Access ignores the acMenuCheck and acMenuUncheck settings for the Flag argument for menu names). |
CommandIndex | Optional | Variant | An integer, counting from 0, that's the valid index of a command on the menu selected by the MenuIndex argument, as defined in the macro group that defines the selected menu for the custom menu bar or global menu bar for the active window. |
SubcommandIndex | Optional | Variant | An integer, counting from 0, that's the valid index of a subcommand in the submenu selected by the CommandIndex argument, as defined in the macro group that defines the selected submenu for the custom menu bar or global menu bar for the active window. |
Flag | Optional | Variant | The state you want to set the command or subcommand to. Can be one of the following constants:
|
Remarks
Use the SetMenuItem method to set the state of menu items (enabled or disabled, checked or unchecked) on the custom menu bar or global menu bar for the active window.
Note
The SetMenuItem method works only with custom menu bars and global menu bars created by using menu bar macros. The SetMenuItem method is included in this version of Access only for compatibility with versions prior to Access 97. It doesn't work with the new command bars functionality.
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 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기