You can use the RunMacro action to run a macro. The macro can be in a macro group.
You can use this action to:
The RunMacro action uses the following arguments.
Action argument |
Description |
Macro Name |
The name of the macro to run. The Macro Name box in the Action Arguments section of the Macro window shows all macros (and macro groups) in the current database. If the macro is in a macro group, it is listed under the macro group name in the list as macrogroupname.macroname. This is a required argument. |
If you run a macro containing the RunMacro action in a library database, Microsoft Access looks for the macro with this name in the library database and doesn’t look for it in the current database. | |
Repeat Count |
The maximum number of times the macro will run. If you leave this argument blank (and the Repeat Expression argument is also blank), the macro runs once. |
Repeat Expression |
An expression that evaluates to True (-1) or False (0). The macro stops running if the expression evaluates to False. The expression is evaluated each time the macro runs. |
If you enter a macro group name for the Macro Name argument, Microsoft Access runs the first macro in the macro group.
This action is similar to clicking Macro on the Tools menu, which runs a specified macro. However, the command runs the macro only once, whereas the RunMacro action can run a macro as many times as you want.
Tip You can use the Repeat Count and Repeat Expression arguments to determine how many times the macro runs:
When you run the original macro, and it reaches the RunMacro action, Microsoft Access runs the called macro. When the called macro has finished, Microsoft Access returns to the original macro and performs the next action.
Note Notes
To run the RunMacro action in Visual Basic, use the RunMacro method of the DoCmd object.
RunMacro Method.