Getting to Know Microsoft Access, Part 9: Macros - Debugging
(Page 3 of 4 )
Once you've built your macro you need to debug it. You can do this in one of two ways: either you can run it and see what happens, or you can step through the macro one step at a time. Use the step-through method if you get unintended results from running the macro or if an error occurs when you run it.
To run the macro, just click the Run button on the toolbar. You can also run a macro from the Database window by choosing the Tools | Macro | Run Macro option. Select the macro you want to run when prompted. If an error occurs when you run the macro, read it and then open the Action Failed dialog box. This dialog tells you which action failed and the arguments being used when it failed. Click "Halt" to stop the macro's execution. Modify the macro appropriately by clicking the Design button while the macro you wish to modify is highlighted in the Database window. Use the Insert Rows and Delete Rows buttons to add new actions and delete unwanted actions from your macro.
Alternatively you can step through the macro, one action at a time, to see how it works. Open the Macro in design view, select the Single-Step toolbar button and then press the Run button. Your options in the step-through dialog box include Step, Halt, and Continue. Step moves you to the next action in the sequence; Halt stops the macro's execution; Continue stops single-step operation and simply runs the rest of the macro. If your macro causes other macros to run, the results of those macros will also be displayed. Here's what the basic step-through dialog box looks like:

Next: Getting Fancy with Macros >>
More Microsoft Access Articles
More By Sage Adams