Using Quick Watch

Introduction to Access 2003 VBA Programming

Introduction to Access 2003 VBA Programming

Context

CUSt0fnPrûlact9_l. Erfli kî.WhSIDatft

EXprflSSiOft newDate

Figure 9-11: The Quick Watch dialog box shows the value of the selected expression in a VBA procedure.

Context

CUSt0fnPrûlact9_l. Erfli kî.WhSIDatft

EXprflSSiOft newDate

Value

3/1/2004

Help

Help

The Quick Watch dialog box contains an Add button that allows you to add the expression to the Watches window. Make sure that the WhatDate procedure does not contain any watch expressions. See the preceding section on how to remove a watch expression from the Watches window. Now, let's see how to take advantage of Quick Watch.

©Hands-On 9-2: Using the Quick Watch Dialog Box

1. In the WhatDate procedure, position the insertion point on the name of the variable, x.

2. Choose Debug | Add Watch.

3. Enter the expression x = 50.

4. Choose the Break When Value Is True option button, and click OK.

5. Run the WhatDate procedure. Visual Basic will suspend procedure execution when x = 50. Notice that the Watches window does not contain either the newDate or curDate variables.

To check the values of these variables, you can position the mouse pointer over the appropriate variable name in the Code window, or you can invoke the Quick Watch dialog box.

6. In the Code window, position the mouse inside the newDate variable and press Shift+F9, or choose Debug | Quick Watch. The Quick Watch dialog boxshows the name of the expression and its current value.

7. Click Cancel to return to the Code window.

8. In the Code window, position the mouse inside the curDate variable and press Shift+F9, or choose Debug | Quick Watch. The Quick Watch dialog box now shows the value of the variable curDate.

9. Click Cancel to return to the Code window.

10. Press F5 to continue running the procedure.

Part I

0 0

Post a comment