Results 1 to 9 of 9
  1. #1
    Soupy8728 is offline Advanced Beginner
    Windows 11 Access 2016
    Join Date
    Mar 2024
    Posts
    30

    Filtering multiple subforms on a main form

    Good morning,

    I have a main form [frmMain] with a listbox on it. I have 3 subforms [subfrmWORKSPEC], [subfrmCFR], [subfrmRCC]. I have been able to connect the listbox to all three subforms via Master/Child fields. When I select an item in the listbox, all three subforms react accordingly and filter to the selected ID in the listbox.

    What I'd like to do is this:



    field [WorkSpec] is a field on all three subforms. I'd like to be able to select the [WorkSpec] field on [subfrmWORKSPEC] and have the other two subforms get filtered based off the text field [WorkSpec]. I just can't seem to get this to work.

    I added a textbox on the main form and called it txtWorkSpec and I set it's control source to =[subfrmWORKSPEC].[Form]![WorkSpec]. When I select [WorkSpec] on the frmWORKSPEC, the txtWorkSpec box changes to match that field so that part is working.

    How do I get the other two subforms to filter on [WorkSpec] based off of the txtWorkSpec field? I can't seem to figure out the correct VBA combination to make this happen. Thanks for your help.

    Soup

  2. #2
    jojowhite's Avatar
    jojowhite is offline Competent Performer
    Windows 11 Access 2021
    Join Date
    Jan 2025
    Posts
    438
    You set the the Parent field of the CFR and RCC subform to [txtWorkSpec].

  3. #3
    Soupy8728 is offline Advanced Beginner
    Windows 11 Access 2016
    Join Date
    Mar 2024
    Posts
    30
    Quote Originally Posted by jojowhite View Post
    You set the the Parent field of the CFR and RCC subform to [txtWorkSpec].
    Thanks for the reply but I'm not exactly sure how to do that. Can you please explain? thank you

  4. #4
    jojowhite's Avatar
    jojowhite is offline Competent Performer
    Windows 11 Access 2021
    Join Date
    Jan 2025
    Posts
    438
    on design view click on subform CFR (make sure a Yellow box surrounds the subform) on its Property Sheet:
    Click image for larger version. 

Name:	prnt.png 
Views:	17 
Size:	7.3 KB 
ID:	52806

    do the same with subform RCC.

  5. #5
    Soupy8728 is offline Advanced Beginner
    Windows 11 Access 2016
    Join Date
    Mar 2024
    Posts
    30
    The master/child fields are already linked to the listbox ID. When I select an item in the listbox, it filters the 3 subforms as it should. I need to filter the CFR and RCC subforms even further by linking them to the WORKSPEC subform [WorkSpec] field (or in this case the text box [txtWorkSpec].

  6. #6
    Soupy8728 is offline Advanced Beginner
    Windows 11 Access 2016
    Join Date
    Mar 2024
    Posts
    30
    Quote Originally Posted by jojowhite View Post
    on design view click on subform CFR (make sure a Yellow box surrounds the subform) on its Property Sheet:
    Click image for larger version. 

Name:	prnt.png 
Views:	17 
Size:	7.3 KB 
ID:	52806

    do the same with subform RCC.
    The master/child fields are already linked to the listbox ID. When I select an item in the listbox, it filters the 3 subforms as it should. I need to filter the CFR and RCC subforms even further by linking them to the WORKSPEC subform [WorkSpec] field (or in this case the text box [txtWorkSpec].

  7. #7
    jojowhite's Avatar
    jojowhite is offline Competent Performer
    Windows 11 Access 2021
    Join Date
    Jan 2025
    Posts
    438
    have you tried it first?
    subform WorkSpec will be the Parent
    while the other 2 subs will be the Children.

  8. #8
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,575
    Filtering and linked are two different concepts.
    If your linkage is already correct, which you say it is, then simply filter the other two subforms with VBA.
    However if that is not the case then link with your mainform txt control.

    You can even set the linkages in VBA, so you start with your now used linkage, then change it to link to txt, and change it back when you update the listbox?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  9. #9
    Soupy8728 is offline Advanced Beginner
    Windows 11 Access 2016
    Join Date
    Mar 2024
    Posts
    30
    Quote Originally Posted by jojowhite View Post
    have you tried it first?
    subform WorkSpec will be the Parent
    while the other 2 subs will be the Children.

    Ok, it worked. Initially I thought it wasn't because the first few line items in the WORKSPEC form didn't have any subform items associated. Thank you for your help! You guys are awesome!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 08-31-2020, 05:02 PM
  2. Replies: 11
    Last Post: 05-13-2015, 11:10 PM
  3. Replies: 3
    Last Post: 01-09-2014, 07:45 PM
  4. Subforms Inside Subforms
    By LordPanzer in forum Access
    Replies: 1
    Last Post: 10-11-2013, 05:19 PM
  5. Multiple subforms to one main form
    By mick3911 in forum Forms
    Replies: 8
    Last Post: 02-25-2013, 09:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums