Selecting Only Text Box Controls In For Each Statement

catbeasy

Registered User.
Local time
Today, 14:59
Joined
Feb 11, 2009
Messages
140
I have some code as:

Dim ctl As Control
For Each ctl In Me.Controls
ctl.Locked = False
Next ctl

Which doesn't work I assume due to the fact that not all the controls on my form have the 'locked' property (some are lables, some command buttons)..

So, wondering how to select only controls that are text so this will work?

Thanks..
 
Code:
Dim ctl As Control
For Each ctl In Me.Controls
   If ctl.ControlType = acTextBox Then
      ctl.Locked = False
   End If
Next ctl
 
Code:
Dim ctl As Control
For Each ctl In Me.Controls
   If ctl.ControlType = acTextBox Then
      ctl.Locked = False
   End If
Next ctl
Perfect! Thanks..
 
Perfect! Thanks..

Sure thing :)

GladWeCouldHelp.png
 

Users who are viewing this thread

Back
Top Bottom