Properties Property

Applies To   ActiveX control, Bound Object Frame control, Chart control, Check Box control, Combo Box control, Command Button control, Control object, Form, Image control, Label control, Line control, List Box control, Option Button control, Option Group control, Page, Page Break control, Rectangle control, Report, Report section, Subform/Subreport control, Tab control, Text Box control, Toggle Button control, Unbound Object Frame control.

Description

You can use the Properties property to return a reference to a control's Properties collection object.

Setting

controlname.Properties[.method or property]

The Properties property uses the following settings.

Setting

Description

controlname

Required. The name of the control whose Properties collection object you want to reference.

Properties

Required. When used without specifying a method or property, returns the Properties collection object.

method or property

A method or property of the Properties collection object. The Item property (collections) is the default property for the Properties collection object.


The Properties property is available only by using Visual Basic.

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.

See Also   Count property ("DAO Language Reference"), Item property (collections).

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.

Sub cmdListProperties_Click()
    ListControlProps Me
End Sub

Sub ListControlProps(frm As Form)
    Dim ctl As Control, 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_bye:
    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
        Resume Next
    End If
End Sub