Microsoft KB Archive/89610

From BetaArchive Wiki
Knowledge Base


ACC: Tips on How to Troubleshoot Microsoft Access Macros

Article ID: 89610

Article Last Modified on 1/18/2007



APPLIES TO

  • Microsoft Access 1.0 Standard Edition
  • Microsoft Access 1.1 Standard Edition
  • Microsoft Access 2.0 Standard Edition
  • Microsoft Access 95 Standard Edition
  • Microsoft Access 97 Standard Edition



This article was previously published under Q89610

Moderate: Requires basic macro, coding, and interoperability skills.

SUMMARY

When a macro doesn't perform correctly, use the following methods 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:

89594 ACC: How to Display Immediate Window Without Module Window



Additional query words: debugging

Keywords: kbusage KB89610