Results 1 to 10 of 10
  1. #1
    MintChipMadness is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    109

    Subform Control

    I can't figure out how to set up my form so it works the way I want. I am creating a data entry form and I would like to have my child subform control (IDChild) to be auto filled with the parent control (IDParent) when it is entered. Also, I would like to keep the subform filtered by what is entered in the parent control. Hopefully someone can help me. I am sorry but I can't attach the database. Just FYI, I used the subform wizard to add a subform to the form (using parent table) I already created. Thank you for your help.




    Tables and Fields

    Boxes (Parent Table)
    Boxes.ID (Parent Field)

    BoxContents (Child Table)
    BoxContents.[Box ID] (Child Field)

    Forms

    dataentry
    Parent Control = IDParent

    BoxContents subform
    Child Control = IDChild

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    If you used the wizard, it should have asked about linking fields. At this point, check the Master/Child Links properties of the subform control. That's what typically keeps a subform in sync with the main form.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    MintChipMadness is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    109
    Quote Originally Posted by pbaldy View Post
    If you used the wizard, it should have asked about linking fields. At this point, check the Master/Child Links properties of the subform control. That's what typically keeps a subform in sync with the main form.
    Dear Paul,
    Thank you for your reply. The fields are linked correctly. I just wanted the child control on the subform to be updated as new records are entered on the parent form. To clarify, when a new record is created I want the IDChild control to autofill with the ID field that was created for the new parent record. I have to select what parent ID to link to in the child when I already entered that on the parent form.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Perhaps I'm not understanding your structure. If the master/child links are set, the subform should automatically populate with the ID field from the parent when you create a new record in the subform.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    MintChipMadness is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    109
    Quote Originally Posted by pbaldy View Post
    Perhaps I'm not understanding your structure. If the master/child links are set, the subform should automatically populate with the ID field from the parent when you create a new record in the subform.
    That is true. When I view the Form with the subform and cycle through the main forms records, the subform will change to related data of the parent field. What I am trying to do is make it so when I am creating a new record using the form, the form will automatically fill in the parent fields information (When Entered) into the child field area of the subform. The problem is when I create a new record I have to fill in the child fields information and I would like to save time and not do that since I when I am creating a new record, I will always be filling in parent and child information at the same time.

  6. #6
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Am I reading this correctly; you want the parents contact information, i.e. phone number, address, etc., also entered into Fields in the child's record?

    If this is your intent, go into Properties - Data of the Subform Control and add/link those Fields, as well as the ParentID field.! You're not limited to one Field when linking the Form/Subform, you can enter multiple Fields.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  7. #7
    MintChipMadness is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    109
    Quote Originally Posted by Missinglinq View Post
    Am I reading this correctly; you want the parents contact information, i.e. phone number, address, etc., also entered into Fields in the child's record?

    If this is your intent, go into Properties - Data of the Subform Control and add/link those Fields, as well as the ParentID field.! You're not limited to one Field when linking the Form/Subform, you can enter multiple Fields.

    Linq ;0)>
    Thank you for your reply Linq. The parent field is already linked to the child field in the subform properties but it still doesn't autofill when I create a new record and enter something in the parent field. If I completely fill out the parent form and then look at the field that is linked in the child, it is not filled out. It is null. My problem might be a limitation in access but I can't be certain. Looks like I will have to fill out that field by hand or figure out some sort of update query to get around the data entry.

  8. #8
    MintChipMadness is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    109
    It makes sense why I wouldn't be able to do this. If I associated the child record with an incorrect parent record, I should be able to change the child to the correct parent. I am just trying to get around that in my data entry form. Looks like I will have to enter it by hand or figure out an update query after all the data is entered.

  9. #9
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Since your description runs counter to the way Access is supposed to work, in this situation, I suspect you'll need to ZIP the file up and attach it here for us to look at, if we're to help you.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  10. #10
    MintChipMadness is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    109
    Quote Originally Posted by Missinglinq View Post
    Since your description runs counter to the way Access is supposed to work, in this situation, I suspect you'll need to ZIP the file up and attach it here for us to look at, if we're to help you.

    Linq ;0)>
    Dear Linq,

    I created a new database that I would be able to attach to this forum and it worked exactly the way I wanted it to. It looks like my problem was due to something I did on my other database. Maybe I changed something I shouldn't have. I'll look into it. I am guessing I need to redo the relationship and then create a new form. Thank you for your help.

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

Similar Threads

  1. Replies: 3
    Last Post: 03-29-2012, 12:40 PM
  2. Replies: 3
    Last Post: 03-02-2012, 03:27 PM
  3. Hide each control, control group or subform?
    By BRV in forum Programming
    Replies: 2
    Last Post: 12-09-2011, 09:36 AM
  4. Replies: 5
    Last Post: 11-16-2011, 07:30 PM
  5. Replies: 5
    Last Post: 10-13-2011, 03:36 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