Cycle through some controls and unlock

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that contains contains over 100 controls (divided into tabs).
The locked default is "Yes". Is there some way I can flag certain controls so
that I can cycle through them with an "Edit" button and unlock them? There
are about 50 that will need to be unlocked and I'd rather not have 50 lines
in VB for Me.Controlname.Locked = False if there is another way. Perhaps
check to see if it is a tab stop and if so, unlock it?

I have the code to cycle through ALL controls to lock them. Any help would
be appreciated.

Thanks!
 
You could use the Tag property of each control you want unlocked or locked.
Put a value in it your code will understand and lock or unlock only the
controls with the value.
 
If you do have the code to loop through all the controls you could use the
tag property of the control. Place the word 'check' (or anything you like) in
the control tag and then in your loop check for the control tag by using an
if statement like

if ctl.tag="check" then
do some locking here
end if

that should do the trick with one loop.
 
Thanks to both of you. This worked very well.

Maurice said:
If you do have the code to loop through all the controls you could use the
tag property of the control. Place the word 'check' (or anything you like) in
the control tag and then in your loop check for the control tag by using an
if statement like

if ctl.tag="check" then
do some locking here
end if

that should do the trick with one loop.
 
Back
Top