Sub getControlProp(frm As String, sCtl As String)
Dim ctl As Control
Dim prp As Property
Open CurrentProject.Path & "\" & frm & "_Controls.txt" For Output As #1
On Error GoTo getPropErr
DoCmd.OpenForm frm, acDesign, , , , acHidden
For Each ctl In Forms(frm).Controls
If ctl.Name = sCtl Then
Print #1, ctl.Properties("Name")
For Each prp In ctl.Properties
Print #1, vbTab & prp.Name & " = " & prp.Value
Next prp
End If
Next ctl
DoCmd.Close acForm, frm, acSaveNo
Set ctl = Nothing
Set prp = Nothing
Close #1
Exit Sub
getPropErr:
If Err = 2187 Then
Print #1, vbTab & prp.Name & " = Only available at design time."
Resume Next
Else
Print #1, vbTab & prp.Name & " = Error Occurred: " & Err.description
Resume Next
End If
End Sub
|