This example is straight out of the ACCESS 97 Help Files
The following example enumerates all the controls in the Controls collection of a form. The procedure is called from a form module and the Me keyword is used to pass the Form object to the procedure. The procedure sets certain properties if the control is a text box.
' Call SetTextBoxProperties procedure.
SetTextBoxProperties Me
Sub SetTextBoxProperties(frm As Form)
Dim ctl As Control
' Enumerate Controls collection.
For Each ctl In frm.Controls
' Check to see if control is text box.
If ctl.ControlType = acTextBox Then
' Set control properties.
With ctl
.SetFocus
.Enabled = True
.Height = 400
.SpecialEffect = 0
End With
End If
Next ctl
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.