Results 1 to 8 of 8
  1. #1
    Kent Bestle is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2016
    Posts
    6

    Main form with 2 subforms linking 2nd sub form to the first subform

    I am wanting to create a form that has two subforms. The Main form is for Orders. Each order may have multiple line items. That is what the first subform is showing in datasheet view, the line items of an order. The Master/child is based on SO#. So far so good. Now I want to add another subform that shows work orders(SFO#'s) for each of the orders line items in the first subform. Master/Child based on SFO#. The second subform when using the property settings to define the Master/child link does not show any of the first subform fields as a possible Master. The drop down only shows fields in the Main form. If this can be done, what I want to happen is when a user clicks on a SFO# field on the first subform I want the second subform to show the records from the SFO line items.
    My other approach was since each form is based on a separate query I thought that I could just make reference to the SFO field in a parameter criteria. i.e. Forms!Mainform!SO# for the first subform to the Main. And for the second subform Forms!Mainform!Subform1.Form!SFO#. As you can see I have struggled to find the right syntax to reference the first subform in the parameter query.
    Not sure it is possible to do this with either of these approaches or if either one will be functionally effective, meaning not real slow, but I appreciate any guidance toward achieving my goal.

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    You do not need to follow the wizard, you can make up any fields to link. The way I do it is to add a hidden textbox to the main form which is then used as the linking field (SFO#), when the user selects an order detail record, populate the main form with the SFO and requery the second subform.

  3. #3
    Kent Bestle is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2016
    Posts
    6
    The SFO field does not exist in the table that the Main form is based on.

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Like I said, doesn't have to.

  5. #5
    Kent Bestle is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2016
    Posts
    6
    So are you saying that when a user clicks in the SFO field on the first subform, set the value of an unbound textbox on the mainform to the SFO# and then requery the subform?

  6. #6
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Yes, that will work. As long as that field on the main form is the one used to link the second subform.

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    Here is an older, free MS Access video from Datapig that may help with the details of subforms.

    It's older, but concepts are great.

  8. #8
    Kent Bestle is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2016
    Posts
    6
    That did the trick. Thanks

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

Similar Threads

  1. Replies: 0
    Last Post: 12-29-2016, 11:19 PM
  2. Replies: 2
    Last Post: 12-09-2015, 04:50 PM
  3. Replies: 11
    Last Post: 05-13-2015, 11:10 PM
  4. Linking Subform Control to Main form
    By KWarzala in forum Forms
    Replies: 1
    Last Post: 03-13-2010, 08:32 PM
  5. Replies: 2
    Last Post: 04-11-2006, 08:40 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