totn Access 2007 VBA Debugging

MS Access 2007: Using the Immediate Window

This MSAccess tutorial explains how to use the Immediate Window in the VBA debugging environment in Access 2007 (with screenshots and step-by-step instructions).

Using the Immediate Window

In Access 2007, the Immediate window can be used to debug your program by allowing you to enter and run VBA code in the context of the suspended program.

Microsoft Access

We've found the Immediate window to be the most help when we need to find out the value of a variable, expression, or object at a certain point in the program. This can be done using the print command.

For example, if you wanted to check the current value of the combo box called cboKeyword, you could use the print command as follows:

Microsoft Access

In this example, we typed print cboKeyword And pressed ENTER. The Immediate window displayed the result in the next line. In this case, the print cboKeyword command returned monitor.

You can also type more complicated expressions in the Immediate window. (Remember to press ENTER.) For example:

Microsoft Access

The Immediate window can be used to run other kinds of VBA code, but bear in mind that the Immediate window can only be accessed when debugging so any code that you run is for debugging purposes only.

Microsoft Access

In this example, the Immediate window can be used to open a report called rptEntries.