Enabling Multiple Controls

  • Thread starter Thread starter Rob
  • Start date Start date
Yes, though one must ask, why such a brute force approach?

You can loop through all the controls in a form this way:

Dim ctl As Control
For Each ctl in Me.Controls
On Error Resume Next
ctl.Enabled = True ' to enable
Err.Clear
Next ctl

But, perhaps you can just set the AllowEdits property of the form to True or
False as a much easier approach?
 
Ken,

What I want is to make sure that the user always clicks on my New button to
create a new record. If the controls are not enabled then the user would be
forced to select the New or Edit button to gain access to the controls. If I
set the AllowEdits property to false the user can still click on the
controls. My New button does some other things in linked tables and I need
to make sure that these things are done. I usually have form open in a new
record but then those commands would not fire until the next new record is
created leaving the current one without some support data needed to be
created in other tables.

Thanks for the help. That will work fine.
 
I have a similar question:

Is there a way , from a command button on FORM1, to check which other forms
are open, and set the ENABLED property of each of those forms to NO?

Thanks
Mark
 
It's called being "lazy"..... or just short on time.... ! < grin >

Nothing wrong with what you do in your code... I do that in other situations
for various reasons. And it's a "cleaner" way to develop.
 

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