Results 1 to 6 of 6
  1. #1
    banpreet is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2016
    Posts
    117

    Linking Parent ID Autonumber with subform

    Hello guys,



    I have a form that generates a master ID (text), then gets carried onto another form, with another id which is parent to the master (autonumber). This parent id is called TR_ID. There will be many ids associated to the master id when searching. Now I have three subforms on this form. I made the id same as the parent id, called it TR_ID on each subform so I can link to the parent ID. Problem is I made TR_ID the parent ID on the subform and linked it with the child ID which is TR_ID on the subform. However when putting information, I just made the subform and the parent ID is on record 59, and when I put information in the subform, in the table the TR_Id gets stored as 1 then 2, then 3, and so on since its autonumber. It won't match with the parent TR_Id 59 or whatever number it will be on. Should I just link the child ID with the master ID on the form? Thanks, all help appreciated!

  2. #2
    jwhite is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Dec 2012
    Location
    North Carolina
    Posts
    349
    Pardon me if I read to quickly, but the Master Link should be the Control on the Main Form, and the Child Link should be the Control on the Sub Form.

  3. #3
    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,726

  4. #4
    trident is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2014
    Posts
    141
    Banpreet,

    here is what I do.

    SAMPLE
    Main Table Child Table

    MainTAutoNumber ChildAutoNumber
    Name ChildTLink - you should link this to the MainTAutonumber
    year Course
    age Section

    When creating a form, use the subreport form wizard and you have to connect the MainTAutoNumber with ChildTLink.

    If done correctly, you will be able to populate the Maint Table and Child Table with only the right information required.

    Trident

  5. #5
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    On the subforms, the parent_id that refers back to the main form (and links to it) cannot be an autonumber. It has to be the same type as the field in the main form.

    That does not mean that the subform records cannot have their own autonumber - in fact they probably should to establish unique ID's.

    It's perfectly OK to have three subforms each referring to (linking to) the same field on the main form, and there is no requirement that the field or control names be the same - it's the links that are important.

  6. #6
    banpreet is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2016
    Posts
    117
    I got it to work, I had to switch the data type to number! Thanks guys it was an easy solution just don't know why it was that hard to figure out.

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

Similar Threads

  1. Replies: 1
    Last Post: 10-04-2016, 04:29 PM
  2. Go To Next Record of Parent Subform
    By PicoTTS in forum Access
    Replies: 1
    Last Post: 09-28-2016, 04:12 PM
  3. Subform with multiple parent forms
    By mwc0914 in forum Forms
    Replies: 8
    Last Post: 03-12-2013, 06:17 AM
  4. Parent/Child subform
    By Jerry8989 in forum Forms
    Replies: 1
    Last Post: 09-18-2009, 07:27 AM
  5. SubForm to Parent
    By henryclay in forum Forms
    Replies: 2
    Last Post: 11-15-2006, 09:44 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