ACC2000: Tips on How to Troubleshoot Microsoft Access Macros (209811)
The information in this article applies to:
This article was previously published under Q209811 Moderate: Requires basic macro, coding, and interoperability skills.
This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).
SUMMARY
When a macro doesn't perform correctly, use the following methods to help
you determine where the problem is located:
- Single Stepping - This feature steps through a macro one action at a time, with a pause between each action. To activate single-step
mode, click the Single Step button on the toolbar or click
Single Step on the Run menu. When any macro is run, it runs in single-step mode until you turn this feature off or
click the Continue button in the Macro Single Step dialog box.
This feature makes it easy to determine if the action items are
listed in the correct sequence. During single-step mode, Microsoft
Access displays the Macro Single Step dialog box, which displays
the macro name, the name of the first action in the macro, and the
arguments for this action. To continue macro execution, you can
click the Step, Halt, or Continue button.
- Action Failed Dialog Box - This feature displays an error message caused by an invalid action. The same information displayed by the Single Step dialog box is displayed in this dialog box. To return to the Macro window and correct the behavior, click the Halt
button.
- MsgBox Action - Insert the MsgBox action in your macro wherever you want to display the value of a control. The action argument for the message is the name of the control that you want to check. For example, to display the value of an unbound control named Field1 in Form1, type the expression =Forms!Form1!Field1 for the message.
- StopMacro Action - This macro action takes no arguments and stops the macro. Use this action to check the results that have been calculated so far. Use this feature together with the Immediate window to display calculated values.
- Immediate Window - You can use this tool to display any values that have been declared. The Immediate window is associated with the Visual Basic Editor. To display the Immediate window, open an existing module, or create a new module, and then click Immediate Window on the View menu. You can also display the Immediate window at any time by pressing CTRL+G. To display a value, type ? (a question mark), type the variable name, and then press ENTER.
Modification Type: | Major | Last Reviewed: | 6/30/2004 |
---|
Keywords: | kbhowto kbinfo kbusage KB209811 |
---|
|