The information in this article applies to:
- Microsoft Access version 1.0, 1.1, 2.0, 7.0, 97
SUMMARY
Moderate: Requires basic macro, coding, and interoperability skills.
This article presents five methods that you can use to troubleshoot a
Microsoft Access macro. When a macro doesn't perform correctly, use the
following tools to help you isolate where the problem is:
- 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 Macro menu. When any macro is run, it will
run in single step mode until you turn this feature off or
click the Continue button in the Macro Single Step dialog box.
This feature make 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 problem, 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 will be the name of the control you want to check. For
example, to display the value of an unbound control named Field1 in
Form1, enter the expression "=Forms!Form1!Field1" (without
quotation marks) for the message.
- StopMacro Action - This macro action takes no arguments and will
stop the macro. Use this action to check the results that have been
calculated so far. Use this feature together with the Debug window to
display calculated values.
NOTE: In Microsoft Access 2.0 and earlier, the Debug window is called
the Immediate window.
- Debug Window - You can use this tool to display any values that have
been declared. The Debug window is associated with module objects. To
display the Debug window, open an existing module, or create a new
module, and then click Debug Window on the View menu. To display a
value, type a (?) question mark, then the variable name, and then press
ENTER.
NOTE: In Microsoft Access 7.0 and 97, you no longer have to have a
module open to display the Debug window. You can display the Debug
window at any time in an active database by pressing CTRL+G.
For information about displaying the Immediate window in versions 1.x
and 2.0 without displaying the Module window, see the following article
in the Microsoft Knowledge Base:
ARTICLE-ID: Q89594
TITLE: ACC: How to Display Immediate Window Without Module
Window
|