AccessObjectProperty Object

Microsoft Access Visual Basic

Show All Show All

AccessObjectProperty Object

Multiple objects AccessObjectProperties
AccessObjectProperty

An AccessObjectProperty object represents a built-in or user-defined characteristic of an AccessObject object.

Using the AccessObjectProperty Object

Every AccessObject object contains an AccessObjectProperties collection that has AccessObjectProperty objects corresponding to the properties of that AccessObject object. The user can also define AccessObjectProperty objects and append them to the AccessObjectProperties collection of some AccessObject objects.

You can create user-defined properties for the following objects:

Note  The AccessObjectProperties collection isn't accessible for objects derived from the CurrentData object (for example, CurrentData.AllTables!Table1). For objects derived in this manner, you can only access their built-in properties by direct calls to the desired property (for example, CurrentData.AllTables!Table1.Name).

To add a user-defined property, use the Add method to create and add an AccessObjectProperty object with a unique Name property setting and Value property of the new AccessObjectProperty object to the AccessObjectProperties collection of the appropriate object. The object to which you are adding the user-defined property must already be appended to a collection. Referencing a user-defined AccessObjectProperty object that has not yet been appended to an AccessObjectProperties collection will cause an error, as will appending a user-defined AccessObjectProperty object to an AccessObjectProperties collection containing an AccessObjectProperty object of the same name.

You can delete user-defined properties from the AccessObjectProperties collection.

Note  A user-defined AccessObjectProperty 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.

The AccessObjectProperty object has two built-in properties:

  • The Name property, a String that uniquely identifies the property.

  • The Value property, a Variant that contains the property setting.

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

CurrentProject.AllForms("Form1").Properties(0)
CurrentProject.AllForms("Form1").Properties("name")
CurrentProject.AllForms("Form1").Properties![name]
		

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

Note  Properties in the AccessObjectProperties collection are not stored and can be lost when when the object they are associated with is checked in or out using the Source Code Control add-in.