Properties Collection

    Example    Methods    Properties

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



Remarks

Every DAO object, except the CdbConnection and CdbError objects, contains a Properties collection, which has certain built-in CdbProperty objects. These CdbProperty 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, and then add it to the collection with the Append method. Referencing a user-defined CdbProperty object that has not yet been appended to a Properties collection will cause an error, as will appending a user-defined CdbProperty object to a Properties collection containing a CdbProperty 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 CdbProperty 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 CdbWorkspace object, or try to read or write a property in an inappropriate context, such as the Value property setting of a CdbField object in the Fields collection of a CdbTableDef object, an error occurs.

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

Properties[0]

Properties["name"]

Note For a user-defined property, use the full object.Properties["name"] syntax.

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