The Object Browser


One of the most important tools you will be working with is the Object Browser. This lets you examine all of the objects available to the project. Notice the word “available.” You may or may not use them. Within each object, you will see the properties, methods, and events associated with that object. You will also be able to see a description and other relevant information associated with that object.

It is worth spending a bit of time learning about this tool. While we’re at it, you will learn some of the terminology associated with objects.

Open the Object Browser by either selecting View | Object Browser or pressing F2. The Object Browser is shown in Figure 7-7.

click to expand
Figure 7-7: The Object Browser

Objects are entities in the computer’s memory. However, they have to come from somewhere. The source of an object is a class, which serves as a kind of template from which an object (which is also called an instance of a class) is created. On the left of the browser, you will see an enormous number of classes. (If you don’t see a list as extensive as the one shown here, don’t worry; you will see why in a bit.) The actual classes and members that are defined in our current project are bolded. Figure 7-7 shows the Form_frmCustomer class selected.

The right side of the browser shows the members of the class. Classes have three main types of members: properties, methods (subs and functions), and events (which are a special kind of sub).

Properties are roughly the equivalent of a field. In true object-oriented programming, a field is sometimes referred to as an attribute. Figure 7-8 shows the AllowDeletions attribute selected. Note the icon to the left of the attribute.

click to expand
Figure 7-8: A property in the Object Browser

Once selected, you can see the description of the property located at the bottom of the browser. Notice that this property returns a Boolean value of either True or False. The form will either allow deletions or not.

A method (which is either a function or a sub), is another type of member. As an example, leave the Form_frmCustomer class selected in the left pane of the Object Browser, then select the GoToPage sub in the right pane. Notice the icon to the left of it and how it is different from the property icon. Also, notice the description at the bottom of the browser, shown here:

click to expand

This is described as a sub. The documentation also shows the parameters the sub will accept, as well as their type and order.

Libraries

These class modules are not just randomly held. Each class module is part of a library of related class modules. In many cases, a class may even access members of other classes. Referring to the previous illustration, you can see the library relationship of the GoToPage sub by clicking on the Member of Access.Form link located at the bottom of the description. Here you can review the other classes in this library.

You can also see the list of available libraries by selecting the library list located at the top of the browser, as shown here:

click to expand

Again, if you do not see the same thing, do not worry; we will be fixing that shortly.

You also have the ability to search the libraries for a particular member. As an example, let’s say that we wanted to see which class files have the sub GoToPage. Referring to Figure 7-9, I have selected All Libraries and typed GoToPage in the field below it. I then clicked on the search icon to the right of the field. The results are shown in the Search Results window. In this case, several class files in the Access and Word libraries contain that sub.

click to expand
Figure 7-9: A library search




Access VBA Programming
Microsoft Access VBA Programming for the Absolute Beginner
ISBN: 1598633937
EAN: 2147483647
Year: 2006
Pages: 214
Authors: Michael Vine

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net