Results 1 to 2 of 2
  1. #1
    Join Date
    May 2007
    Posts
    27

    Unanswered: Filtering based on recordcount in child subform? Howto?

    Hi,

    I have a simple parent-child form built in access. It works flawless.

    When scrolling through the parent records, the child subform shows related records. Not all parent records have related records, so in that case the child subform shows nothing. This is perfect, this is how I want it.

    Now my question. Can I filter the parent form to only show the parent records that have child records (i.e. the recordcount for the child subform is at least 1 or more)?

    Can this be done? Do I need VBA, or can this be done with right-click and then use the filter options.

    Thanks!

    PS: using access 2003 (forgot to mention that in the original post)

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    All you would need to do is set the Record Source for the parent form to use an SQL that joins the child records to the parent records with an inner join. Set it back to the "normal" (what you have now) when you want to remove the "filter". You can do this with VBA with Me.RecordSource = SQLStatement
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •