Allowedits question regarding subform on form

G

Guest

I have a form with a subform. The oncurrent event of the form
(Allowedits=False).

I have a button on the main form which (Allowedits=True). Problem I am
having is how to make the subform also follow the same rules without the
addition of another button.

It seems like this should be fairly simple, but I can't seem to grasp it.

Thanks.

Mike
 
A

Al Camp

Mike,
This should work (use your names)
Private Sub cmdAllowEdits_Click()
Me.AllowEdits = True
Me.frmYourSubFormName.Form.AllowEdits = True
End Sub
 
A

Allen Browne

Mike, take a look at:
Locking bound controls on a form and subforms
at:
http://allenbrowne.com/ser-56.html

AllowEdits prevents you entering anything even into unbound controls (e.g.
those used for filtering or navigation) which is not very helpful, so the
article explains how to loop through the bound controls, setting the Locked
property of each one.

As the code loops through the controls on the form, when it comes to a
subform control it calls itself recursively, so that subforms and
sub-subforms are locked as well, to any depth.

It also supports exceptions, so you have the option to leave some controls
unlocked if needed, and others that will not become unlocked.
 

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

Top