Microsoft Access 2010 Bible

(Rick Simeone) #1

Chapter 14: Debugging Your Access Applications


545


examine the results of the rs assignment statement. Unfolding the rs entry in the Locals window
reveals all the properties of the rs object and its contents (see Figure 14.21).

FIGURE 14.21

Use the Locals window to examine the values of complex objects.


One powerful feature of the Locals window is that you can set the values of simple variables
(numeric, string, and so on) by clicking on the Value column in a variable’s row and typing in a
new value for the variable. This makes it very easy to test how various combinations of variable
values affect your application.

In the preceding section, I tell you how to move the execution point within a procedure by drag-
ging the yellow arrow with the mouse. By changing the value of a variable and moving the execu-
tion point to different places in the procedure, you can verify that the code executes as expected.
Directly manipulating variables is much easier than other methods of testing the effect of outliers
and unexpected values.

Setting watches with the Watches window
The Locals window can be overrun with variables in a large application or in an application with
many variables in scope. The Watches window enables you to specify just which variables you
want to monitor as you single-step through your code. The value of a watched variable changes
dynamically as the code runs. (You need to be at some kind of breakpoint, of course, to actually
see the values.) The advantage of using the Watches window is that the variables displayed don’t
have to be from the local procedure. In fact, the variables in the Watch window can be from any
part of the application.
Free download pdf