RunCommand Visual Basic Example Microsoft Access


Programming Access RunCommand in Visual Basic

Every menu item in Microsoft Access has an associated RunCommand argument. This menuitems can therefore be run from within Access Visual Basic. You can’t use the RunCommand method to run a command on a custom menu. You can only use it with built-in menus.

The RunCommand method replaces the DoMenuItem method of the DoCmd object.

There is some overlap between DoCmd and RunCommand actions.  The DoCmd method often gives you more control over equivalent RunCommand methods.

(note: we will be adding definitions and descriptions of the functions for each RunCommand option in future updates of this page)

 RunCommand AcCommand Constants with numeric equivalent

acCmdAboutMicrosoftAccess    35

Docmd.RunCommand acCmdAboutMicrosoftAccess caused the Microsoft Access about box to open

acCmdAddInManager    526

Docmd.RunCommand acCmdAddInManager causes the COM add in manager to popup

acCmdAddToNewGroup    494

Docmd.RunCommand acCmdAddToNewGroup is not available at run time – unable to get this command to function

acCmdAddWatch    201

Docmd.RunCommandacCmdAddWatch  not available at runtime.

More RunCommand Method Examples:

Access Database Security Alternative
RunCommand acCmdSaveRecord ‘ ‘ set global access level to failsafe no access then lookup access level ‘ GBL_Access_Level = “X”

NotInList Event in Microsoft Access
RunCommand acCmdSaveRecord Form_F_Trds_Unbnd.Accnt_Name_Entry.Requery Form_F_Trds_Unbnd.Accnt_Number_Combo.Requery ‘ Form_F_Trds_Unbnd.Accnt_ID = Me…


Microsoft Office VBA, MS Access 2003, 2007, 2010, 2013, 2016