Microsoft Office Tutorials and References
In Depth Information
Understanding Objects and Collections
Many objects support methods. If you right-click a form name in the
Navigation Pane, for example, you see a contextual menu like the one shown
in Figure 4-7. Most of the items you see on the menu are methods — things
you can do to the object.
Figure 4-7:
When you’re working in VBA, of course, the visual interactive tools that
Access offers — tools such as contextual menus and property sheets —
aren’t visible. In VBA, you write code to access collections, objects,
properties, methods, and events.
Referring to objects and collections
Manipulating an object through VBA code starts with a two-step process:
Chapter 4
1. Declare an object variable (by using Dim) as the appropriate object or
collection type.
2. Set the object variable (by using the Set keyword) to a specific object
or collection within your database.
The syntax of the statements for performing those two steps looks like this:
Dim anyName As objectType
Set anyName = specificObject
anyName is a variable name of your choosing, the objectType is one of the
keywords shown in the first column of Table 4-3, and specificObject
represents a specific named object.
Search JabSto ::

Custom Search