Allowedits question regarding subform on form

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
Mike,
This should work (use your names)
Private Sub cmdAllowEdits_Click()
Me.AllowEdits = True
Me.frmYourSubFormName.Form.AllowEdits = True
End Sub
 
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.
 
Back
Top