Form.CommandExecute event (Access)

Occurs after the specified command is executed. Use this event when you want to execute a set of commands after a particular command is executed.


expression.CommandExecute (Command)

expression A variable that represents a Form object.


Name Required/Optional Data type Description
Command Required Variant The command that is executed.

Return value



The OCCommandId, ChartCommandIdEnum, and PivotCommandId constants contain lists of the supported commands for each of the Microsoft Office web components.


The following example demonstrates the syntax for a subroutine that traps the CommandExecute event.

Private Sub Form_CommandExecute(ByVal Command As Variant) MsgBox "The command specified by " _ 
 & Command.Name & " has been executed." 
End Sub

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.