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.
-
Right-click the macro in the Navigation Pane, and then click Design View .
-
On the Design tab, in the Tools group, click Single Step .
-
Click Run . 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.
-
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:
-
Right-click the macro action where you want single stepping to begin, and then click Insert Rows .
-
In the Action list, click SingleStep. This action has no action arguments.
-
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 so that it is not highlighted.
-
No comments:
Post a Comment