Requery subform from a subform

I have a form with two subforms on a main form that are not bound together.  In subform1 I have a field that when I click on it I want it to requery the totals in subform2.  I would like to add the code to the On Click module of the field.

How do I do this?  
mtrussellAsked:
Who is Participating?
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
From inside of Subform1 ... and on a Text box

Private Sub Text1_Click()
    Me.Parent.Subform2.Form.Requery
     '  OR   Me.Parent.Subform2.Form.ReCalc

End Sub

Change Text1 to the name of your text box, and Subform2 to the name of that subform Control on the Main form.
0
 
Nico BontenbalCommented:
Suppose the controls that hold the subforms on the main form are called subform1 and subform2 (the controls can have a different name than the form they contain). You can add this code in the onclick event of the control on subform1:
me.parent!subform2.form.requery

'Me' refers to the form subform 1. '.Parent' refers to the form containing the subform. '!subform2' refers to the control on the main form. '.Form' refers to the form inside the subform control.
0
 
mtrussellAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.