5.2. Your Access Database and VBA Project—Better Together

You might wonder how a VBA Project and your Access database correlate. Well, in a nutshell, here's what you need to know. First, you get one VBA Project for every Access database you create. The objects in the Project Explorer shown in Figure 5-1 are present no matter where in your Access database you're writing code. You could be writing code behind a Form or Report, or in a module. Regardless, you'll see the same objects listed in the Project Explorer. Second, don't confuse the VBA Project with an Access Project. An Access Data Project (ADP) is a completely different entity, covered in Chapter 17.

5.2.1. Using the Object Browser

The Object Browser is probably one of the most powerful tools you'll use when writing VBA code. You can display the Object Browser by selecting Object Browser from the View menu of the VBA Editor or by clicking F2 within the VBA Editor. The Object Browser, shown in Figure 5-2 has a number of components.

When you load the Object Browser, you'll notice that you can still view the Project Explorer and the Properties window. The Object Browser appears directly over the Code window. You can return to the Code window at any time by selecting Code from the View menu or by clicking F7. There are several components of the Object Browser you'll use often.

  • The Project/Library box shows all the available type libraries. We'll discuss how to add a type library to your Project later in this chapter. You can ...

Get Access 2003 VBA Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.