Requering Subform's

King Kreglo

Registered User.
Local time
Today, 04:59
Joined
Aug 31, 2013
Messages
32
Hi!

What I'm trying to do is update a subform based off a control in a seperate subform

I have a question that I know is doable but is too tricky for me to figure out, so thanks in advance to the prodigy who can help me out with this headache :)

I am building a tool to track our companies clients, many of whom have multiple accounts.
I have a form with a Navigation Control (frmAccounts) and a subform (frmMasterAccounts).
The subform contains the "master account's" for the users to select from which house the multiple sites (accounts) in the Navigation Form.

I have temporary variables in place so that the query filters to show only the accounts under the master account when one has been selected but I can't figure out how to make the Navigation form requery or refresh like it should.

Each tab under the Nav. form contains a different subform based off of a query. I've tried requering all these queries and requering the subforms themselves but nothing seems to work.

Any help or suggestions would be appreciated, thanks :)

-Nick
 

Attachments

  • requery issues.jpg
    requery issues.jpg
    96.5 KB · Views: 107
Last edited:
If the Sub-Form(s) record source Queries' criteria depends on a value of a control on the Main Form, then you may try to refresh, rather than requery, the Main Form to update the underlying queries and reflect the change on the sub-forms automatically.

The Me.Refresh action can be executed from an AfterUpdate() or Onclick() Event procedure of a control on the main form.

If you are trying to run an Event Procedure on the Tab Page click event procedure and doesn't work then take a look at the following link:

Control SetFocus on Tab-Page-Click
 
Last edited:
Your method worked perfectly!
I did have to remove the main form and move the navigation control into the MasterAccount form though. I hadn't realized that Access had automatically applied a filter to my sub forms on the tab controls so that's why I couldn't get it to work right away.

Here's what I used to make it work if you're interested :)

Code:
    Me.[frmCMAnalysis-ForManagingAccounts].SetFocus
        If Not IsNull(Me.cboCompanySelect.Value) Then
            Me.txtCompanyName.SetFocus
            DoCmd.FindRecord Me.cboCompanySelect.Value
        End If
    Me.navSiteDetails.Pages(0).SetFocus
    Me.Customer_Contact_Information.Requery

Thanks a bunch for the help, I appreciate it!
 

Users who are viewing this thread

Back
Top Bottom