Microsoft Office Tutorials and References
In Depth Information
Working with Visual Basic Editor
Using the Object Browser
VBA code can manipulate Access objects programmatically. Remember that
everything in Access is an object. Tables, forms, reports, and even single
controls on forms or reports are objects. Every object that you see onscreen
in Access, you can manage either interactively or programmatically. When
you work with objects in the Access program window, using your mouse and
keyboard, you use Access interactively — that is, you do something with
your mouse and keyboard, and the object responds accordingly.
When you write code, you write instructions that tell Access to manipulate
an object programmatically, without user intervention. You write
instructions to automate some task that you may otherwise do interactively with
mouse and keyboard. To manipulate an object programmatically, you write
code that refers to the object by name.
All the objects that make up Access and the current database are organized
in an object model, which comprises one or more object libraries. An object
library is an actual file on your hard drive that provides the names of objects
that VBA refers to and manipulates.
Each object consists of classes, and each class is a single programmable object.
Each class has members, and some members are properties — characteristics
of the class, such as its name or the number of items it contains. Other
members are methods, which expose things you can do to the class
The object model is huge, containing many libraries and classes. There’s no
way to memorize everything in the object model; it’s just too darn big. Visual
Basic Editor provides an Object Browser that acts as a central resource for
finding things, as well as getting help with things in the model. It’s especially
useful for deciphering other people’s code, like the examples you see later in
To view the objects that VBA can access, follow these steps to open the
1. Make sure that you’re in Visual Basic Editor.
2. Click the Object Browser button in the toolbar, choose View ➪ Object
Browser from the menu, or press F2.
Figure 1-12 shows the Object Browser and points out some of the major
features of its window. The following list describes the browser’s components:
✦ Project/Library list: This list allows you to choose a single library or
project to work with, or <All Libraries>.
✦ Search tools: Use these tools to find information in the libraries.