Properties

A property is a physical attribute of an object. Each property can have multiple values. For example, the properties for a car object include color (silver), doors (four), and cylinders (four). However, the car has objects of its own. The car's tire object has a brand property of Michelin. The car's carpet object has properties of style (plush) and clean (true).

Some properties of an object can be easily changed. If you want to change the value for the car's property color, you take it to an auto detailer and choose another color. With one spilled latte, the carpet's property clean is turned to false. However, you can't easily change the number of doors on the car. And, short of completely replacing the engine, you can't change the number of cylinders. Similarly, objects in VBA have some properties that can be changed and some that cannot.

Additionally, every object in Access also has properties. The form object, for instance, has many properties including Border Style, Width, Height, and Caption. Each of these properties has range of possible values. The Border Style property, for example, can be set to None, Thin, Sizable, and Dialog—each choice presents the form object with a slightly different look. Before you start manipulating properties in VBA code, take a look at the object and examine some of its properties. In the case of a form, launch the form in design mode and change some of its properties. Then run the form to see how the changes affect not only the display but also the operation of the form. (Forms and controls generally have quite a few properties and options, but they're relatively logical and you typically work with only a few. You'll learn more about forms in Chapter 10.)

Was this article helpful?

0 0

Post a comment