I would like to loop through the controls in a form, and if the control is a text box, I want to either enable or disable it. It was something like
Code: Select all
for each cntrl in controls
Code: Select all
for each cntrl in controls
Code: Select all
Dim cntrl As Control
For Each cntrl In Me.Controls
If cntrl.ControlType = acTextBox Then
' code for text boxes goes here
Else
' code for other types of controls goes here
End If
Next cntrl
Code: Select all
Sub ToggleFields(OnOff As Boolean)
Dim cntrl As Control
For Each cntrl In Me.Controls
If cntrl.ControlType = acTextBox Then
cntrl.Enabled = OnOff
End If
Next cntrl
End Sub