>
Property Object
Description
A Property object represents a built-in or
user-defined characteristic of a data access object.
Remarks
Every data access object 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.
You specify built-in properties when you create a new data access
object. You can set the properties of some existing data access
objects using an assignment statement.
The Property object also has four built-in
properties:
- The Name property, a String that uniquely
identifies the property.
- The Type property, an Integer that
specifies the property data type.
- The Value property, a Variant that contains
the property setting.
- The Inherited property, a Boolean flag that
indicates whether the property is inherited from another
object. For example, a Field object in a Fields
collection of a Recordset object can inherit
properties from the underlying TableDef or QueryDef
object.
In addition to these built-in properties, you can
create and add your own user-defined properties to these objects:
- Database, Index, QueryDef, and TableDef
objects
- Field objects in Fields collections of QueryDef
and TableDef objects
To add a user-defined property, use the CreateProperty
method to create a Property object with a unique Name
property setting. Set the Type and Value properties
of the new Property object, and then append it to the Properties
collection of the appropriate object. The object to which you are
adding the user-defined property must already be saved to disk
(that is, it must be appended to a collection).
You can delete user-defined properties from the Properties
collection, but you can't delete built-in properties.
Note
A user-defined property (Property object) is
associated only with the specific instance of the object whose Properties
collection you append it to. 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), an error occurs.
You can refer to an existing built-in or
user-defined property by its Name property setting using
this syntax:
object.Properties("name")
For a built-in property, you can also use this
syntax:
object.name
You can also reference properties by their ordinal
position using this syntax, which refers to the first member of
the Properties collection:
object.Properties(0)
A user-defined property differs from a built-in
property of a data access object in the following ways:
- You must refer to a user-defined property using the full Properties("name")
syntax.
- If you haven't previously set the property's value, you
need to create it first using the CreateProperty
method.
Properties
Inherited Property, Name Property, Type
Property, Value Property.
See Also
CreateProperty Method; Database Object;
Appendix, "Data Access Object Hierarchy."
Specifics (Microsoft Access)
See the Properties collection specifics
(Microsoft Access).
Example
See the Properties collection example.
Example (Microsoft Access)
See the Properties collection example
(Microsoft Access).