Microsoft Access 2010 Bible

(Rick Simeone) #1

Part II: Programming Microsoft Access


544


FIGURE 14.20

Auto Data Tips are a powerful tool for debugging.


The Auto Data Tips display you see by hovering the mouse over a variable is very dynamic. The
value shown in Auto Data Tips changes whenever the variable is assigned a new value. Because
hovering the mouse is easy to do, you don’t have to use the Immediate window to view every vari-
able in your code.

Note
The Auto Data Tips option must be selected in the Modules tab in order for the data tip you see in Figure 14.20
to appear. (See the “Auto Data Tips” section, earlier in this chapter, for more on this option.)


One very nice feature of breakpoints is that the execution pointer (the yellow arrow in the left mar-
gin) is movable. You can use the mouse to reposition the pointer to another statement within the
current procedure. For example, you can drag the pointer to a position above its current location
to re-execute several lines of code.

You can easily reposition the execution pointer in such a way that your code’s execution is invalid,
such as moving it into the body of an If...Then...Else statement, or into the middle of a
loop. Also, moving the pointer to a position lower in the code may mean that variables aren’t set
correctly or an important bit of code is ignored. Overall, though, the ability to easily re-execute a
few lines of code is a valuable debugging aid.

Looking at variables with the Locals window
The Locals window (View ➪ Locals Window) shows all variables that are currently in scope, saving
you from having to examine each variable one at a time. The variable’s name, its data type, and its
current value are displayed.

Notice the items in the Locals window in Figure 14.21. Any line in the Locals window that begins
with a plus sign will unfold to reveal more information. For example, you can set a breakpoint on
the End Function statement at the bottom of the function to halt execution so that you can
Free download pdf