Argument | Description |
menubar | Use the intrinsic constant acFormBar for the menu bar in Form view. |
For other views, use the number of the view in the Menu Bar argument list, as shown in the Macro window in previous versions of Microsoft Access (count down the list, starting from 0). | |
menuname | You can use one of the following intrinsic constants: |
acFile acEditMenu acRecordsMenu | |
You can use acRecordsMenu only for the Form view menu bar in Microsoft Access version 2.0 and Microsoft Access 95 databases. | |
For other menus, use the number of the menu in the Menu Name argument list, as shown in the Macro window in previous versions of Microsoft Access (count down the list, starting from 0). | |
command | You can use one of the following intrinsic constants: |
acNew acSaveForm acSaveFormAs acSaveRecord acUndo acCut acCopy acPaste acDelete acSelectRecord acSelectAllRecords acObject acRefresh | |
For other commands, use the number of the command in the Command argument list, as shown in the Macro window in previous versions of Microsoft Access (count down the list, starting from 0). |
subcommand | You can use one of the following intrinsic constants: |
acObjectVerb acObjectUpdate | |
The acObjectVerb constant represents the first command on the submenu of the Object command on the Edit menu. The type of object determines the first command on the submenu. For example, this command is Edit for a Paintbrush object that can be edited. | |
For other commands on submenus, use the number of the subcommand in the Subcommand argument list, as shown in the Macro window in previous versions of Microsoft Access (count down the list, starting from 0). | |
version | Use the intrinsic constant acMenuVer70 for code written for Microsoft Access 95 databases, the intrinsic constant acMenuVer20 for code written for Microsoft Access version 2.0 databases, and the intrinsic constant acMenuVer1X for code written for Microsoft Access version 1.x databases. This argument is available only in Visual Basic. |
Note The default for this argument is acMenuVer1X, so that any code written for Microsoft Access version 1.x databases will run unchanged. If you're writing code for a Microsoft Access 95 or version 2.0 database and want to use the Microsoft Access 95 or version 2.0 menu commands with the DoMenuItem method, you must set this argument to acMenuVer70 or acMenuVer20. | |
Also, when you are counting down the lists for the Menu Bar, Menu Name, Command, and Subcommand action arguments in the Macro window to get the numbers to use for the arguments in the DoMenuItem method, you must use the Microsoft Access 95 lists if the version argument is acMenuVer70, the Microsoft Access version 2.0 lists if the version argument is acMenuVer20, and the Microsoft Access version 1.x lists if version is acMenuVer1X (or blank). | |
Note There is no acMenuVer80 setting for this argument. You can't use the DoMenuItem method to display Microsoft Access 97 commands (although existing DoMenuItem methods in Visual Basic code will still work). Use the RunCommand method instead. |
DoCmd.DoMenuItem acFormBar, acEditMenu, acPaste, , acMenuVer70
The next example carries out the Tile command on the Window menu in Form view in a Microsoft Access version 2.0 database:
DoCmd.DoMenuItem acFormBar, 4, 0, , acMenuVer20