Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 851531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:26:30+00:00 2026-05-15T07:26:30+00:00

I have frmParentForm with multiple controls used to build a filter for frmSubForm. On

  • 0

I have frmParentForm with multiple controls used to build a filter for frmSubForm.

On frmParentForm_Load, I am doing (simplified example):

Me.sbfInvoice_List.Form.filter = "[created_on] >= #" & Me.RecentOrderDateCutoff & "#"
Me.sbfInvoice_List.Form.FilterOn = True

The problem is, on initial load, it seems the subform load is occurring first, so the entire table is loaded.

Is there a way (in a different event perhaps) to properly set the subform filter from the parent form so it is applied before the subform does its initial data load? (The subform can exist on its own, or as a child of many different parent forms (sometimes filtered, sometimes not), so I’d rather not put some complicated hack in the subform itself to accomplish this.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T07:26:31+00:00Added an answer on May 15, 2026 at 7:26 am

    Because the subform loads before the parent form, the parent form can not set a subform filter before the subform initially loads.

    If you want to use the subform flexibly (all records when stand alone, but different subsets of records when included on different parent forms), I think you have to modify the subform to do it.

    Private Sub Form_Open(Cancel As Integer)
        Dim strParent As String
        Dim strMsg As String
    
    On Error GoTo ErrorHandler
    
        strParent = Me.Parent.Name
        Select Case strParent
        Case "frmYourParentForm"
            'set filter to only records from today '
            Me.Filter = "[created_on] >= #" & Date() & "#"
            Me.FilterOn = True
        Case "frmSomeOtherParent"
            'do something else '
        End Select
    
    ExitHere:
        On Error GoTo 0
        Exit Sub
    
    ErrorHandler:
        Select Case Err.Number
        Case 2452
            'The expression you entered has an invalid reference to '
            'the Parent property. '
            Resume Next
        Case Else
            strMsg = "Error " & Err.Number & " (" & Err.Description _
                & ") in procedure Form_Open"
            MsgBox strMsg
        End Select
        GoTo ExitHere
    End Sub
    

    Edit: If you want to track the sequence of events in the parent form and subform, you can add procedures like this one to the forms’ modules.

    Private Sub Form_Load()
        Debug.Print Me.Name & ": Form_Load"
    End Sub
    

    Here is what I get when tracking the Open and Load events for my parent form and subform.

    fsubChild: Form_Open
    fsubChild: Form_Load
    frmParent: Form_Open
    frmParent: Form_Load
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have you used VS.NET Architect Edition's Application and System diagrams to start designing a
Have a build process that can't be edited and need to pack another war
have anyone seen a Solr plugin example written in Clojure? I guess it should
I have found this example on StackOverflow: var people = new List<Person> { new
I have a login.jsp page which contains a login form. Once logged in the
I want to have generalised email templates. Currently I have multiple email templates with
Have just started using Google Chrome , and noticed in parts of our site,
Have you ever seen any of there error messages? -- SQL Server 2000 Could
Have you guys had any experiences (positive or negative) by placing your source code/solution
Have just started using Visual Studio Professional's built-in unit testing features, which as I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.