one edit button for form, subform and subsubform

D

deb

I have a main form called fSite
it has a subform called fPlant
it has a subform called fUnit

How can I have one Edit button on the main form and when clicked it sets all
forms for edit?

Thanks
 
M

Maurice

Deb,

Try something like:

Private sub Button1_Click()
Me.AllowEdits = True
Forms!fPlant.AllowEdits = True
Forms!fPlant!fUnit.AllowEdits = True
End Sub

hth
 
P

Pat Hartman

Your code needs a line for each form.

Me.allowedits = True
Me.fPlant.Form.Allowedits = True
Me.fUnit.Form.Allowedits = True

if fUnit is a subform of fPlant then
Me.fPlant.Form!fUnit.Form.AllowEdits = True
 
M

Maurice

Ok in that case go through the collection

Private sub Button1_Click()
Me.AllowEdits = True
Forms!fSite!fPlant.AllowEdits = True
Forms!fSite!fPlant!fUnit.AllowEdits = True
End Sub

try again...
 
D

deb

Thank you for your help.

The below worked for me...
Me!fPlantSub.Form.AllowEdits = True
Me!fPlantSub.Form!fUnitSub.Form.AllowEdits = True
 

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

Similar Threads


Top