Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Perhaps you should post a compacted/zipped db copy for analysis. If you have PO id (master) on main form and subform (child) I cannot envision what the issue is as long as you are committing a main form record before trying to add child records. If that is not the case, then you're still inputting data in the wrong fashion. I can only imagine that is because a) you're trying to insert subform records first, or b) you're starting a main form record first but for some reason, it's not being committed before you start adding po list items in the subform. Simply moving the focus from the main form to the sub should be enough to commit the po record so it's puzzling if that's the scenario.
    A db sample would cut to the chase. All that's needed is the 2 forms and whatever tables support them and instructions on how to replicate your issue.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  2. #17
    Join Date
    Mar 2023
    Location
    Georgia
    Posts
    8
    @Micron,

    So are you trying to say that you could never enter data into the subform first and then enter data into the main form last?

  3. #18
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    That is what we have been saying since page 1 of this thread.
    The PO main form has 1 pk id for each po - say that id will be 155 for the next po. The list items table (subform table) would have a pk for each line item (not important for this explanation) but for every line item record for that next po, the foreign key (fk) would the pk value of 155. How can you assign child record (line items) unless you create that pk value for the po (parent record)? Until you create the main form (po) record you have no idea what the id value will be - the id value that has to go into every line item record.

    I cannot see for the life of me why anyone would try to add line items without the po record/number. You wouldn't even do this if it was being done with paper po forms.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #19
    Join Date
    Mar 2023
    Location
    Georgia
    Posts
    8
    Thanks Micron! It makes sense. I just wish I knew about that rule before, but live and learn. So I will have the user input data into the main form first to get the PK and then have them enter the line items into the subform.

  5. #20
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    (Analogy)Think of it as Parent and Child.

    Every child has a parent, and the parent exists before child is created.
    The PO table and PODetail table are related 1 to Many.
    The parent table refers to data of the parent which is the 1 side of the 1 to Many relationship.
    The subform represents the Many side.

    Also, to add to this mix, in Access subforms open before parent form.
    See this thread for more info The related video is here.

    It might be helpful if you posted a copy of your relationships and/or a sample(reduced data)copy of your database.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 09-05-2014, 10:21 AM
  2. Replies: 1
    Last Post: 07-18-2014, 04:11 AM
  3. Subform gives data to main form
    By wlanssens in forum Forms
    Replies: 8
    Last Post: 12-01-2013, 07:06 PM
  4. Replies: 14
    Last Post: 08-01-2013, 09:46 PM
  5. copy data from a subform to the main form
    By declanfogarty in forum Programming
    Replies: 1
    Last Post: 06-23-2011, 05:31 AM

Tags for this Thread

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