Test a macro by using Single Step mode

Applies To
Access for Microsoft 365 Access 2024 Access 2021 Access 2019 Access 2016

By using single-step mode for a macro, you can watch the macro run one action at a time. This helps you see the results of each action and isolate any action that causes an error or an unwanted result.

  1. Right-click the macro in the Navigation Pane, and then click Design View.

  2. On the Macro Design tab, in the Tools group, click Single Step.

  3. Click Run. If the macro is new or has been edited, you're prompted to save it before you can run it. The Macro Single Step dialog box appears. It shows information about the macro and the current macro action, along with the error number. A zero in the Error Number box means that no error has occurred. Macro Single Step dialog box

  4. Do one of the following:

    • To carry out the action shown in the Macro Single Step dialog box, click Step.
    • To stop the macro and close the dialog box, click Stop All Macros.
    • To turn off single stepping and run the remainder of the macro, click Continue.

Remarks

  • To begin single stepping while a macro is running, press Ctrl+Break.

  • To begin single stepping at a specific point in your macro, add the SingleStep macro action where you want single stepping to begin. Use the following procedure to add the SingleStep macro action to your macro:

    1. In the Action Catalog on the right side of the macro design window, search for SingleStep. If the Action Catalog isn't displayed, turn it on. On the Design tab, in the Show/Hide group, click Action Catalog.
    2. Drag the SingleStep macro action from the Action Catalog onto the design window and drop the action above or below where you want the single stepping to begin. This action has no action arguments.
    3. Save the macro by clicking Save on the Quick Access Toolbar. If single stepping is off when you click Run, the macro runs normally until it reaches the SingleStep macro action that you inserted. At that point, the macro starts single stepping. You can add multiple SingleStep actions to a macro. Clicking Continue in the Macro Single Step dialog box turns single stepping off until Access reaches the next SingleStep action. If single stepping is on when the macro ends, it stays on. If you run another macro, Access displays the Macro Single Step dialog box again. To turn off single stepping, click Continue in the Macro Single Step dialog box. Or, on the Design tab, in the Tools group, click Single Step so that it isn't highlighted.