Access VBA Macro Programming

(Joao Candeias) #1

in scope (meaning it is used within the procedure you are running), and it will give you the
value of it instantly. You can also move the point of execution by dragging the yellow arrow
to the line of code to be executed.
Try this simple program:


Sub TestDebug()
x = 2
Do Until x = 1
x = x + 1
Loop
End Sub


When you run this, the program never finishes becausexwill never equal 1. Press
CTRL-BREAK,and the error window will appear. Click Debug, and you will be in instant
watch mode in the code window. Move your cursor across any instance ofxand its value will
appear (see Figure 7-1).


Chapter 7: Debugging 83


Figure 7-1 An example of instant watch

Free download pdf