Team LiB
Previous Section Next Section

Chapter 7: Understanding theVisual Basic Editor

In Chapters 5 and 6, we took a brief tour of the VBA environment as well as the structure behind the VBA language. In this chapter, as well as subsequent ones, we are going to drill down to greater levels of detail.

We’ll start here by revisiting the VBA Editor and the menus and toolbars that you will use with it. We’ll look at the different parts of the editor and examine the available options. You will also learn how to use some of the help features available should you need them.

Opening the VBA Editor

A good place to start learning about the editor is to understand the different ways you can access it. You already saw a couple of ways in Chapters 5 and 6, but they are worth reviewing here.

From Microsoft Access, you can access the editor in any of the following ways:

No matter what technique you use to get to the VBA Editor, you should see something like Figure 7-1 when you open it. The main window, occupying most of the editor, is the Code window where you do the actual coding. As you will see in subsequent chapters, the code will vary depending on the object you are looking at.

Click To expand
Figure 7-1: The VBA Editor

The Project Explorer window, the window on the upper left side of Figure 7-1, contains not just the list, but the hierarchy of code objects for the project. The Properties window, on the lower left side in Figure 7-1, contains a list of properties associated with an object, such as a form or report, and what their current settings are.

We will look at the interaction of the Properties and Project windows in a bit. However, I want to mention three windows that you will use for testing and debugging: the Immediate window, the Watch window, and the Locals window. These are discussed in greater detail when we look at testing and debugging in Chapter 10.

Each of these windows can be opened, closed, moved, or resized like any other window in the Windows environment. You can also use the View command to assist in this process. As an example, you can close the Properties window by clicking the X in the upper-right corner. To reopen it, select View | Properties Window, or press F4.


Team LiB
Previous Section Next Section