Test a macro by using Single Step mode

By single stepping through a macro, you can observe the flow of the macro and the results of each action, and isolate any action that causes an error or produces unwanted results.

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

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

  3. Click Run button image. If the macro is a new or edited macro, you will be prompted to save the macro before you can run it.

    The Macro Single Step dialog box appears. This dialog box displays information about the macro and the macro action, as well as the error number. A zero in the Error Number box means 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, you can add the SingleStep macro action to your macro at the point where you want single stepping to begin. Use the following procedure to add the SingleStep macro action to your macro:

    1. Right-click the macro action where you want single stepping to begin, and then click Insert Rows Button image inserting row in lookup table.

    2. In the Action list, click SingleStep. This action has no action arguments.

    3. Save the macro by clicking Save on the Quick Access Toolbar.

      Assuming that single stepping is turned off when you click Run, execution will proceed normally up to the point where you inserted the SingleStep macro action, and then the macro will begin single stepping. You can add multiple SingleStep actions to a macro. Clicking Continue in the Macro Single Step dialog box will switch single stepping off until the next SingleStep action is encountered.

      If single stepping is on when the macro ends, it will remain on. If you run another macro, Access will display 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 Button image so that it is not highlighted.

Applies To: Access 2007



Was this information helpful?

Yes No

How can we improve it?

255 characters remaining

To protect your privacy, please do not include contact information in your feedback. Review our privacy policy.

Thank you for your feedback!

Support resources

Change language