Locked/Enable multiple fields

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

Guest

Is there an easy way to set the "locked" and "enabled" properties of multiple
fields on a form:

Me.HouseID.Locked=True
Me.HouseName.Locked=True
Me.HouseAddLine1.Locked=True
etc

Many thanks
Scott
 
Scott,

The answer is yes, if you can somehow logically group the controls you
want to lock. For instance, the following will lock all controls whose
name starts with House:

For Each ctl In Me.Controls
If Left(ctl.Name, 5) = "House" Then ctl.Locked=True
Next

Alternatively, the following will lock all tetxboxes regardless of name:

For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then ctl.Locked=True
Next

HTH,
Nikos
 
Superb
That saves a lot of typing!!
Many thanks for quick repsonse

Scott
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top