[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Requery subform from a subform

Posted on 2011-04-19
Medium Priority
Last Modified: 2012-05-11
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?  
Question by:mtrussell
LVL 75

Accepted Solution

DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 2000 total points
ID: 35426622
From inside of Subform1 ... and on a Text box

Private Sub Text1_Click()
     '  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.
LVL 22

Expert Comment

by:Nico Bontenbal
ID: 35426634
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' 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.

Author Closing Comment

ID: 35704642

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question