DoCmd.SetMenuItem (Access)
The SetMenuItem method carries out the SetMenuItem action in Visual Basic.
You can 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.
SetMenuItem (MenuIndex, CommandIndex, SubcommandIndex, Flag)
Dim iMenuIndex As Integer: iMenuIndex =
DoCmd.SetMenuItem MenuIndex:=iMenuIndex
Arguments
The following argument is required
MenuIndex (Integer) - 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).
Optional arguments
The following arguments are optional
CommandIndex (Integer) - 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 (Integer) - 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 - The state you want to set the command or subcommand to. Can be one of the following constants: acMenuCheck acMenuGray acMenuUncheck acMenuUngray (default)