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

    Linking multiple subforms

    Hello all,

    I have a MainForm (unbound) that has 4 subforms on it. The subforms are called Locations, Inventory, Groups, and SubGroups. I have been able to link master/child fields using the LocationID on the Locations subform. I watched Richard Rost's YouTube video on how to syncronize the forms and all is working well with the following exception. When I select a Location, the Inventory and Groups subforms filter appropriately. What I'd like to further do is link the SubGroups subform to the Groups subform so that when I select a record on Groups, the SubGroups form filters further. (man I hope I'm explaining this well). If you are not too confused by now, I'd really appreciate some guidance.

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,552
    One way is to put the value of thesubform control on the mainform and use that to link the other subform. You would hide that control on the mainform
    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

  3. #3
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,421
    As long as OP is willing to use VBA because you need to use a form's Current event to set the value of the linking control? However, it may be that the control you refer to needs to go on the parent subform? Not sure of what the relationship is from one form to another, but I'm thinking the problem subform contains records that are related to a parent subform. There might not be a pk/fk relationship between the main form and this last subform.

    EDIT - WGM, never mind. I misinterpreted your suggestion.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    Soupy8728 is offline Advanced Beginner
    Windows 11 Access 2016
    Join Date
    Mar 2024
    Posts
    30
    Quote Originally Posted by Welshgasman View Post
    One way is to put the value of thesubform control on the mainform and use that to link the other subform. You would hide that control on the mainform
    Yes sir, I did that using Richard Rost's video information and everything links fine (all four subforms link with no issues). Would I have to add another control in addition to the first one? They all link with LocationID but I'd like the SubGroups subform to link to the Groups subform via GroupID. Thank you for you awesome help!

  5. #5
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,820
    Are you able to upload a screenshot of the relationship diagram so we can see all table fields?

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,552
    Well you can only link one or the other.
    Groups are linked by locationid, so by relationships, if you link groups to subgroups, they will inherit the locationid from groups parent?
    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

  7. #7
    Join Date
    Apr 2017
    Posts
    1,792
    You didn't gave any info about your table structures (what would be essential to get better responses) in your post, so I can only guess here, but I suspect it is off somewhat.

    It looks like you have some items. Every item belongs into some item subgroup (like stool, or desk). Those subgroups then belong into some item groups (like furniture). All those items are placed somewhere (in some location). And probably this location of at least for some items may change (the item may be moved to another location).

    So you need tables like:
    tblLocations: LocationID, LocqationDescription, ...;
    tblItemGroups: ItemGroupID, ItemGroupName;
    tblItemSubgroups: ItemSubgroupID, ItemGroupID, ItemSubgroupName;
    tblItems: ItemID, ItemSubgroupID, ItemDescription, ...;
    tblItemLocqations: ItemLocationID, ItemID, LocationID, LocatedAtDate, ..., [LocationStatus] (this table is essentially what you have named Inventory, but it contains the full history of item movements to different locations. LocationStatus is optional field, which is 1 wehn the locatoin of item is current one, and 0 otherwise. Or you can have an UDF instead, which returns the current location of item at any date.)

    Is this something like you have?

  8. #8
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Yes, you just add a second hidden control to the parent form that is bound to the GroupID on the Groups subform; then use that as the master field in the linking for the subgroup subform (depending on your design needs you could use both, separated by semicolon Link Child: LocationID;GroupID, Link Master: frmMain!txtHiddenLocationID;frmMain!txtHiddenGroup ID).

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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. Linking SubForms
    By sushi in forum Forms
    Replies: 5
    Last Post: 01-17-2018, 02:58 PM
  3. Linking forms without using subforms
    By tomnsd in forum Forms
    Replies: 3
    Last Post: 01-22-2013, 12:41 PM
  4. Help with append queries and linking subforms
    By MelonFuel in forum Queries
    Replies: 1
    Last Post: 07-11-2012, 01:47 PM
  5. Linking Subforms on Unbound Master Form?
    By 10 Gauge in forum Forms
    Replies: 8
    Last Post: 07-21-2011, 08:06 AM

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