Properties Property

Microsoft Access Visual Basic

Returns a reference to an AccessObject, CurrentProject, or CodeProject object's AccessObjectProperties collection.

expression.Properties

expression    Required. An expression that returns one of the above objects.

Remarks

The AccessObjectProperties collection object is the collection of all the properties related to an AccessObject, CurrentProject, or CodeProject object. You can refer to individual members of the collection by using the member object's index or a string expression that is the name of the member object. The first member object in the collection has an index value of 0 and the total number of member objects in the collection is the value of the AccessObjectProperties collection's Count property minus 1.

You cannot use the Properties property to return properties from an AccessObject object which is a member of a collection accessed from a CurrentData object.

ShowProperties property as it applies to the SmartTag object.

Returns a SmartTagProperties collection that represents the collection of properties for a particular smart tag.

expression.Properties()

expression    Required. An expression that returns a SmartTag object.

ShowProperties property as it applies to all other objects in the Applies To list.

Return a reference to a control's Properties collection object.

expression.Properties

expression    Required. An expression that returns one of the objects in the Applies To list.

Remarks

The Properties collection object is the collection of all the properties related to a control. You can refer to individual members of the collection by using the member object's index or a string expression that is the name of the member object. The first member object in the collection has an index value of 0 and the total number of member objects in the collection is the value of the Properties collection's Count property minus 1.

Example

The following procedure uses the Properties property to print all the properties associated with the controls on a form to the Debug window. To run this code, place a command button named cmdListProperties on a form and paste the following code into the form's Declarations section. Click the command button to print the list of properties in the Debug window.

Private Sub cmdListProperties_Click()
    ListControlProps Me
End Sub

Public Sub ListControlProps(ByRef frm As Form)
    Dim ctl As Control
    Dim prp As Property

    On Error GoTo props_err

    For Each ctl In frm.Controls
        Debug.Print ctl.Properties("Name")
        For Each prp In ctl.Properties
            Debug.Print vbTab & prp.Name & " = " & prp.Value
        Next prp
    Next ctl

props_exit:
    Set ctl = Nothing
    Set prp = Nothing
Exit Sub

props_err:
    If Err = 2187 Then
        Debug.Print vbTab & prp.Name & " = Only available at design time."
        Resume Next
    Else
        Debug.Print vbTab & prp.Name & " = Error Occurred: " & Err.Description
        Resume Next
    End If
End Sub