Properties Collection

   Example   Properties   Methods      Summary

A Properties collection contains all the Property objects for a specific instance of an object.



Remarks

Every DAO object except the Connection and Error objects contains a Properties collection, which has certain built-in Property objects. These Property objects (which are often just called properties) uniquely characterize that instance of the object.

In addition to the built-in properties, you can also create and add your own user-defined properties. To add a user-defined property to an existing instance of an object, first define its characteristics with the CreateProperty method, then add it to the collection with the Append method. Referencing a user-defined Property object that has not yet been appended to a Properties collection will cause an error, as will appending a user-defined Property object to a Properties collection containing a Property object of the same name.

You can use the Delete method to remove user-defined properties from the Properties collection, but you can't remove built-in properties.

Note A user-defined Property object is associated only with the specific instance of an object. The property isn't defined for all instances of objects of the selected type.

You can use the Properties collection of an object to enumerate the object's built-in and user-defined properties. You don't need to know beforehand exactly which properties exist or what their characteristics (Name and Type properties) are to manipulate them. However, if you try to read a write-only property, such as the Password property of a Workspace object, or try to read or write a property in an inappropriate context, such as the Value property setting of a Field object in the Fields collection of a TableDef object, an error occurs.

To refer to a built-in Property object in a collection by its ordinal number or by its Name property setting, use any of the following syntax forms:

object.Properties(0)

object.Properties("name")

object.Properties![name]

For a built-in property, you can also use this syntax:

object.name

Note For a user-defined property, you must use the full object.Properties("name") syntax.

With the same syntax forms, you can also refer to the Value property of a Property object. The context of the reference will determine whether you are referring to the Property object itself or the Value property of the Property object.