Chapter 13: Accessing Data with VBA Code
487
An object’s Properties collection is made up of a number of Property objects. Each
Property object has its own set of properties. Properties can be referenced directly, created
through the Access interface, or created by a user and added to the Properties collection. You
generally refer to a property in this way: ObjectName.PropertyName. For example, to refer to the
Name property of a field, the syntax would be as follows:
MyField.Name
Methods are a little different. A method is an action an object can perform, or is an action per-
formed on an object. The purpose of a data access object is to manipulate or display data in a data-
base; therefore, each object must have some way to act upon that data. You can’t add or delete
methods in the ADO or DAO objects. (This is one of the several ways that Access is not truly object
oriented.) You can only invoke the method on the object. For example, the following code places
the record pointer of the recordset MyRecordset at the next record:
MyRecordset.MoveNext
Like properties, every ADO and DAO object has a set of methods applicable to that object.
If you ever need to know more about an ADO or DAO object, use the Object Browser (shown in
Figure 13.7). Open the Object Browser from within the VBA Editor by pressing F2 or choosing
View ➪ Object Browser from the menu in the VBA editor window. The Object Browser lets you
examine each object’s methods and properties and the arguments you can expect when using them.
The Object Browser is used by all Microsoft applications that feature VBA as their language engine.
FIGURE 13.7
The Object Browser provides a view into an object’s properties and methods.
Library drop-down list
Selected object
Property
Method syntax Event Method