Learn Access 2003 VBA with The Smart Method
80
www.LearnAccessVBA.com
Lesson 4-5: Use the immediate
window to view and change
variable contents
We’ve already seen how easy it is to set breakpoints and to step through
code using the debug tools.
Programmers often want to examine the contents of different variables at
particular points in code execution. The Immediate window lets you do
just that. It’s hard to exaggerate how useful the Immediate window is
when de-bugging code.
1
Set a break point in your code on the Beep command in the
ThankYouMessage sub routine.
2
Click the command button on your frmTest form to begin
code execution.
The code editor window opens with code execution halted at the
Beep command.
3
Enable the Immediate Window if it is not already visible.
The immediate window will be at the bottom of the code window
if it is enabled. If not select View Immediate Window from the
main menu to make it appear.
4
Display the contents of the strMessage variable in the
immediate window.
Session4b