Results 1 to 12 of 12
  1. #1
    SusanCoder is offline Advanced Beginner
    Windows 8 Access 2016
    Join Date
    Mar 2016
    Posts
    30

    parent/child link for two side-by-side subforms that are both on a main form

    I'm having trouble with the parent/child link for two side-by-side subforms.



    My project has 3 forms:
    • frmAdvocateEventAdd (main form, unbound, holder for subforms)
    • subfrmAdvocateEventInformation (subform, single form, event information, AdvEventID primary key)
    • subfrmAdvocateEventYouthDetail (subform, continuous form, individual person information, AdvEvent foreign key)


    The form allows the user to add an event, and the individual advocates assigned to the event. I'm designing the forms/subforms this way because I will eventually have a fourth continuous subform that will describe the payment for each advocate.

    The two subforms are side-by-side within the main form. I'm trying to link subfrmAdvocateEventInformation (parent) and subfrmAdvocateEventYouthDetail) (child) from the Property Sheet, Data tab of subfrmAdvocateEventYouthDetail. I've gone through several iterations of syntax (periods vs exclamation point, brackets vs no brackets). I'm not sure if syntax is the issue, but here is my link and error message.

    Link Master Fields
    Code:
     frmAdvocateEventAdd.Form!subfrmAdvocateEventInformation.Form!AdvEventID
    Link Child Fields
    Code:
     subfrmAdvocateEventYouthDetail.AdvEventID
    AdvEventID from the parent form is not being recognized. When I try to open the main form frmAdvocateEventAdd, I get a pop-up window "Enter Parameter Value" frmAdvocateEventAdd.Form!subfrmAdvocateEventInform ation.Form!AdvEventID.

    Thanks for your help.

    Susan

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Review http://www.fmsinc.com/MicrosoftAcces...edSubforms.asp

    I have used this technique twice. In one case it works great and in the other I had issues when creating new records. But been so long can't remember exactly what.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,463
    I don't think you need the long syntax for the field, should just be able to put AdvEventID in both LinkMaster and LinkChild fields in the subform property as long as that is the name of the linked field in both tables.

  4. #4
    SusanCoder is offline Advanced Beginner
    Windows 8 Access 2016
    Join Date
    Mar 2016
    Posts
    30
    June7, thanks for the suggestion. I read through the attachment and I did need a refresher on the value vs. control source names. I'm making progress because now I'm getting a different error farther into the processing!

    I'll include what I'm working with now. I removed the reference to the main form frmAdvocateEventAdd in the master link field. I renamed the control source in the subfrmAdvocateEventInformation to txtAdvEventID from AdvEvent. I updated the master link to include the control source name rather than the field name. (I also updated the control source name for subfrmAdvocateEventYouthDetail, as I will be linking it as the master later on.)

    subfrmAdvocateEventInformation (master)
    Control source when AdvEventID is selected
    Code:
     =[subfrmAdvocateEventInformation].[Form]![txtAdvEventID]
    ; Name = AdvEventID

    subfrmAdvocateEventYouthDetail (child)
    Control source when AdvEventID is selected
    Code:
     =[subfrmAdvocateEventYouthDetail].[txtAdvEventID]
    ; Name = AdvEventID

    Link on selected control of subfrmAdvocateEventYouthDetail
    Link Master Fields
    Code:
     [subfrmAdvocateEventInformation].[Form]![txtAdvEventID]
    Link Child Fields
    Code:
     [subfrmAdvocateEventYouthDetail].[Form]![AdvEventID]
    Now an error message doesn't occur when I open the main form frmAdvocateEventAdd, but does occur when I try to add an Advocate to an Event.
    "Microsoft Access can't find the field 'txtAdvEventID' referred to in your expression. You may have misspelled the field name, or the field may have been removed or deleted."

    Thanks, again, for help.

    Susan

  5. #5
    SusanCoder is offline Advanced Beginner
    Windows 8 Access 2016
    Join Date
    Mar 2016
    Posts
    30
    Thanks, Bulzie. When I try the simple method of entering "AdvEventID" in both parent and child link fields, I get a pop-up asking for the value of AdvEventID on opening the main form.

    When I tried entering "txtAdvEventID" in the parent link field, and "AdvEventID" in the child link field, I get a pop-up asking for the value of txtAdvEventID on opening the main form.

  6. #6
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,463
    You should have a field on both main and subform called AdvEventID and the main form one should always have a value. If the subform has not related record it would be blank. Maybe something is misspelled on the main form? Make sure the fields are named correctly.

  7. #7
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    I'm trying to link subfrmAdvocateEventInformation (parent) and subfrmAdvocateEventYouthDetail) (child)
    I'm having trouble with the parent/child link for two side-by-side subforms
    These two sentences contradict each other - the child subform is not a child and the parent subform is not a parent. They are siblings! The main form is the parent and all subforms are children. If you are dealing with only one advocate and/or one event at a time then put those two fields on the main form as combobox selections. Then link all subforms to those fields.

  8. #8
    SusanCoder is offline Advanced Beginner
    Windows 8 Access 2016
    Join Date
    Mar 2016
    Posts
    30
    Thanks for responding, atyee11. My model looks like this: 1 event (single subform), 1+ advocates for each event (continuous subform), 1+ payment types for each advocate (continuous subform).

  9. #9
    SusanCoder is offline Advanced Beginner
    Windows 8 Access 2016
    Join Date
    Mar 2016
    Posts
    30
    Thanks for the reply Bulzie. The AdvEventID field is on both forms, and the field is a required field on the main form. I checked and they are both spelled the same.

  10. #10
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Main form - select event
    advocates subform - linked by event
    payments subform - when the user selects an advocate on the subform, populate a hidden advocateID field on the main form, link the payment subform using that field.

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Why don't you bind the main form to EventInformation?

    Then will only have to use the referenced link technique for linking advocate form with its dependent payment form.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  12. #12
    SusanCoder is offline Advanced Beginner
    Windows 8 Access 2016
    Join Date
    Mar 2016
    Posts
    30
    Thanks, everyone, for your suggestions. I'll be working on this project this afternoon, and will post if I make headway. Otherwise, I'll be off this project for several weeks, and will post when I get to a solution.

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

Similar Threads

  1. split table and join it again side by side
    By andifi in forum Queries
    Replies: 3
    Last Post: 02-02-2017, 03:24 AM
  2. Replies: 2
    Last Post: 07-25-2016, 01:12 PM
  3. Showing parameter fields side by side
    By sebgrb in forum Queries
    Replies: 2
    Last Post: 03-07-2014, 02:25 AM
  4. Report side by side comparing category
    By bbmak in forum Reports
    Replies: 5
    Last Post: 01-12-2014, 12:43 PM
  5. Replies: 11
    Last Post: 07-20-2011, 11:28 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