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. |
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