Chapter 14: Debugging Your Access Applications
543
In Figure 14.19, the break has occurred and I’ve clicked on the Step Into button (or pressed F8).
The Step Into button executes the next statement in the program’s flow of execution. In this case,
the SQL statement is composed and assigned to sSQL. If I wanted to view the value of sSQL at this
point, I could flip to the Immediate window (Ctrl+G) and use ?sSQL to print its value in the
Immediate window. I could also have a watch set on sSQL and view its value in the Watch window
(described in the “Setting watches with the Watches window” section, later in this chapter).
FIGURE 14.19
Step Into executes one line at a time.
Notice the execution pointer (a yellow arrow) in the Margin Indicator bar pointing at the last line
of the SQL statement. This arrow tells you where execution is actually stopped. The line pointed to
by the arrow has not yet executed, so any action performed in the statement has not occurred.
Consecutive clicks on the Step Into button (or pressing F8) walks through the code one statement
at a time. If a statement includes a call to a child procedure, you’ll be taken to that procedure and
walked through it. If you want, you can use the Step Over button (or press Shift+F8) to step
“through” the child routine. If you’ve previously debugged the child routine and you’re sure it con-
tains no errors, there is no reason to walk through its code. The code in the called routine is actu-
ally executed when you click on the Step Over button, changing any variables involved.
When you’re satisfied that you don’t need to continue walking through the code in the child pro-
cedure, click on the Step Out button (or press Ctrl+F8) to complete the procedure. The Step Out
button is handy if you’ve stepped into a called routine and you’re sure there’s nothing interesting
going on in it.
One very nice feature in the Access VBA window is the Auto Data Tips option in the Modules tab
in the Options dialog box. With this option selected, you’re able to view the value of any variable
in a tooltip-like window by hovering the mouse pointer over the variable’s name in the module
window (see Figure 14.20).