Setting all of the controls on a form to locked

  • Thread starter Thread starter Stever
  • Start date Start date
S

Stever

I need to set all of the controls on a form to locked = true when the form
is first opened and when an edit button is clicked set them all to locked =
false. Is there an efficient way to do this?

Thanks in advance for any suggestions you may have?

Steve
 
-----Original Message-----
I need to set all of the controls on a form to locked = true when the form
is first opened and when an edit button is clicked set them all to locked =
false. Is there an efficient way to do this?

Thanks in advance for any suggestions you may have?

Steve
Hi Steve,

you could use:
me.allowedits = false
to make entire form read only.
me.allowedits=true
to make entire form read/write.

Use properties to set form to allowedits=false as initial
form property.

or to cycle through controls use a procedure with a
parameter to change setting that is called as required:

private sub LockControls(LockOn as boolean)
dim ctl as control
for each ctl in controls
with ctl
select case .controltype
case actextbox, accombobox,aclistbox
.locked=lockon
end select
end with
doevents
end with
end sub

then to lock controls use:
LockControls false

Luck
Jonathan
 
Back
Top