When converting DoMenuItem to RunCommand, it is worth knowing what the numbers after DoMenuItem represent. If you have a piece of code that says DoMenuItem 0,1,2 then you can make an educated guess as to what it is trying to do. The first number (0 in this case) refers to the menu being used. The second number (1) refers to the top level menu item counting from the left starting at 0. So 0 is normally File, 1 Edit etc. The third number refers to the Item in the menu itself again starting from 0. As the menus changed between versions there may be a fourth element stating which version of menus it is refering to.
Below are 3 tables showing the DoMenuItem code with what I think is the RunCommand equivalent. The first table is for the Access 7 menu system. There are also tables for the Access 2 and Access 1 menu systems.
There may be some duplication as you can refer to menus both by a number and a constant. If your DoMenuItem has just numbers and no version number at the end of the line then it is using Access 1 menus.
Note: Some of these are items do not equate exactly and may have more than one RunCommand equivalents.
If you know of any additional conversions or spot any errors then please let me know so that I can make this area as complete as possible.
Access 7 Menu System
DoCmd.DoMenuItem | RunCommand |
---|---|
acFormBar, acEditMenu, 2 | acCmdCopy |
acFormBar, acEditMenu, 5 | acCmdPasteAppend |
acFormBar, acEditMenu, 6 | acCmdDeleteRecord |
acFormBar, acEditMenu, 8 | acCmdSelectRecord |
acFormBar, acEditMenu, 10 | acCmdFind |
acFormBar, acEditMenu, 12, 4 | acCmdRecordsGoToNew |
acFormBar, acEditMenu, acCopy | acCmdCopy |
acFormBar, acEditMenu, acPaste | acCmdPaste |
acFormBar, acEditMenu, acUndo | acCmdUndo |
acFormBar, acFile, acSaveForm | acCmdSave |
acFormBar, acRecordsMenu, 0, 2 | acCmdAdvancedFilterSort |
acFormBar, acRecordsMenu, 2 | acCmdApplyFilterSort |
acFormBar, acRecordsMenu, 5 | acCmdRefresh |
acFormBar, acRecordsMenu, acSaveRecord | acCmdSaveRecord |
acFormBar, 7, 6 | acCmdSizeToFit |
1, 3, 3 | acCmdNewObjectReport |
3, acEditMenu, acPaste | acCmdPaste |
Access 2 Menu System
DoCmd.DoMenuItem | RunCommand |
---|---|
A_FORMBAR, 2, 0 | acCmdDesignView |
A_FORMBAR, 2, 1 | acCmdFormView |
A_FORMBAR, 2, 2 | acCmdDatasheetView |
A_FORMBAR, 2, 3 | acCmdSubformDatasheet |
A_FORMBAR, 2, 4 | acCmdToolbarsCustomize |
A_FORMBAR, 2, 5 | acCmdOptions |
A_FORMBAR, 4, 0 | acCmdTileVertically, acCmdTileHorizontally |
A_FORMBAR, 4, 1 | acCmdWindowCascade |
A_FORMBAR, 4, 2 | acCmdWindowArrangeIcons |
A_FORMBAR, 4, 3 | acCmdWindowHide |
A_FORMBAR, 4, 4 | acCmdWindowUnhide |
A_FORMBAR, 4, 5 | acCmdSizeToFitForm |
A_FORMBAR, 5, 0 | acCmdMicrosoftAccessHelpTopics |
A_FORMBAR, 5, 1 | acCmdAnswerWizard |
A_FORMBAR, 5, 3 | acCmdMicrosoftOnTheWeb |
A_FORMBAR, 5, 4 | acCmdAboutMicrosoftAccess |
A_FORMBAR, A_EDITMENU, 10 | acCmdFind |
A_FORMBAR, A_EDITMENU, 11 | acCmdReplace |
A_FORMBAR, A_EDITMENU, 12 | acCmdInsertObject |
A_FORMBAR, A_EDITMENU, 13 | acCmdOLEDDELinks |
A_FORMBAR, A_EDITMENU, 5 | acCmdPasteSpecial |
A_FORMBAR, A_EDITMENU, 6 | acCmdPasteAppend |
A_FORMBAR, A_EDITMENU, A_COPY | acCmdCopy |
A_FORMBAR, A_EDITMENU, A_CUT | acCmdCut |
A_FORMBAR, A_EDITMENU, A_DELETE_V2 | acCmdDelete |
A_FORMBAR, A_EDITMENU, A_OBJECT, A_OBJECTVERB | acCmdOLEObjectDefaultVerb |
A_FORMBAR, A_EDITMENU, A_PASTE | acCmdPaste |
A_FORMBAR, A_EDITMENU, A_PASTE | acCmdPaste |
A_FORMBAR, A_EDITMENU, A_SELECTALLRECORDS_V2 | acCmdSelectAll |
A_FORMBAR, A_EDITMENU, A_SELECTRECORD_V2 | acCmdSelectRecord |
A_FORMBAR, A_EDITMENU, A_UNDO | acCmdUndo |
A_FORMBAR, A_EDITMENU, A_UNDOFIELD | acCmdUndo |
A_FORMBAR, A_FILE, 1 | acCmdClose |
A_FORMBAR, A_FILE, 10 | acCmdRunMacro |
A_FORMBAR, A_FILE, 12 | acCmdExit |
A_FORMBAR, A_FILE, 5 | acCmdOutputToExcel, acCmdOutputToRTF, acCmdOutputToText |
A_FORMBAR, A_FILE, 6 | acCmdPageSetup |
A_FORMBAR, A_FILE, 7 | acCmdPrintPreview |
A_FORMBAR, A_FILE, 8 | acCmdPrint |
A_FORMBAR, A_FILE, 9 | acCmdSend |
A_FORMBAR, A_FILE, A_NEW,0 | acCmdNewObjectTable |
A_FORMBAR, A_FILE, A_NEW,1 | acCmdNewObjectQuery |
A_FORMBAR, A_FILE, A_NEW,2 | acCmdNewObjectForm |
A_FORMBAR, A_FILE, A_NEW,3 | acCmdNewObjectReport |
A_FORMBAR, A_FILE, A_NEW,4 | acCmdNewObjectMacro |
A_FORMBAR, A_FILE, A_NEW,5 | acCmdNewObjectModule |
A_FORMBAR, A_FILE, A_SAVEFORM | acCmdSave |
A_FORMBAR, A_FILE, A_SAVEFORMAS | acCmdSaveAs |
A_FORMBAR, A_FILE, A_SAVERECORD | acCmdSaveRecord |
A_FORMBAR, A_RECORDSMENU, | acCmdDataEntry |
A_FORMBAR, A_RECORDSMENU, 1, 0 | acCmdRecordsGoToFirst |
A_FORMBAR, A_RECORDSMENU, 1, 1 | acCmdRecordsGoToLast |
A_FORMBAR, A_RECORDSMENU, 1, 2 | acCmdRecordsGoToNext |
A_FORMBAR, A_RECORDSMENU, 1, 3 | acCmdRecordsGoToPrevious |
A_FORMBAR, A_RECORDSMENU, 1, 4 | acCmdRecordsGoToNew |
A_FORMBAR, A_RECORDSMENU, 3,0 | acCmdSortAscending |
A_FORMBAR, A_RECORDSMENU, 3,1 | acCmdSortDescending |
A_FORMBAR, A_RECORDSMENU, 4 | acCmdAdvancedFilterSort |
A_FORMBAR, A_RECORDSMENU, 5 | acCmdApplyFilterSort |
A_FORMBAR, A_RECORDSMENU, 6 | acCmdRemoveFilterSort |
A_FORMBAR, A_RECORDSMENU, 7 | acCmdEditingAllowed |
A_FORMBAR, A_RECORDSMENU, A_REFRESH | acCmdRefresh |
A_FORMBAR, A_RECORDSMENU, A_SAVERECORD | acCmdSaveRecord |
1, A_FILE, 0 | acCmdNewDatabase |
1, A_FILE, 1 | acCmdOpenDatabase |
1, A_FILE, 2 | acCmdClose |
1, A_FILE, 3, 0 | acCmdNewObjectTable |
1, A_FILE, 3, 1 | acCmdNewObjectQuery |
1, A_FILE, 3, 2 | acCmdNewObjectForm |
1, A_FILE, 3, 3 | acCmdNewObjectReport |
1, A_FILE, 3, 4 | acCmdNewObjectMacro |
1, A_FILE, 3, 5 | acCmdNewObjectModule |
1, A_FILE, 4 | acCmdRename |
1, A_FILE, 5 | acCmdOutputToExcel, acCmdOutputToRTF, acCmdOutputToText |
1, A_FILE, 6 | acCmdImport |
1, A_FILE, 7 | acCmdSaveAs |
1, A_FILE, 8 | acCmdLinkTables |
1, A_FILE, 11 | acCmdPrintPreview |
1, A_FILE, 12 | acCmdPrint |
1, A_FILE, 14 | acCmdSend |
1, A_FILE, 17 | acCmdExit |
1, A_EDITMENU, 1 | acCmdCut |
1, A_EDITMENU, 2 | acCmdCopy |
1, A_EDITMENU, 3 | acCmdPaste |
1, A_EDITMENU, 4 | acCmdDelete |
1, A_EDITMENU, 5 | acCmdRelationships |
1, 3, 0 | acCmdUserAndGroupPermissions |
1, 3, 1 | acCmdUserAndGroupAccounts |
1, 3, 2 | acCmdUserAndGroupAccounts |
Access 1 Menu System
DoCmd.DoMenuItem | RunCommand |
---|---|
2, 4, 1, 0 | acCmdApplyFilterSort |