Results 1 to 11 of 11
  1. #1
    tcox's Avatar
    tcox is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Oct 2015
    Posts
    46

    Form entries disappear when subform receives its first entry.

    Form entries disappear when subform receives its first entry.



    I created my form T_Orders table, then drag-drop my T_Order_Details onto it, so it made a sub form.
    I have a few fields that get their default value from the main form, as soon as one has a value entered, the subform gets updated with the new default value, then the main forms entries go blank.

    The T_Orders table shows an entry for all the selected info, but now the T_Order_Details entries no longer associate their PK-FK relationship.

    ................
    1. form is opened, as soon as entry related to T_Orders table made, entry is made.
    2. form has dropdown box that lists machines for order form, once this selection is made, the sub form self populates the new 1st entry with this information, the main form now looses all its previous entries, like it now wants to create a new record. After the subform has its entry in, the main form will keep its entries if entered again (and another entry is made in the Orders Table)

    How do I go about the proper way of creating a form and sub form relationship so I can avoid this behavior?

    Thanks
    -Tevis

  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,931
    Is the subform container control SourceObject a table or query or form?

    Really need to know more about the form design. If you want to provide db for analysis, follow instructions at bottom of my post.
    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
    tcox's Avatar
    tcox is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Oct 2015
    Posts
    46
    Machine_Assemblies copy.zip

    F_Order_Details_idea
    and
    F_Order_Details_subform

    are the two forms I'm working on at present.

    Thanks!
    -Tevis

  4. #4
    tcox's Avatar
    tcox is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Oct 2015
    Posts
    46
    Still working on this. Built a new set of forms with the same result.
    If I make drop down or entry boxes that house default values for (F_OrderForm_subform) columns in the main form (F_OrderForm), when data is entered into them, the main form (F_OrderForm)'s entries disappear as a new entry is made, as it advances to the next PK in T_Orders.

    Click image for larger version. 

Name:	Form.jpg 
Views:	4 
Size:	43.9 KB 
ID:	22265

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Controls Machine and ThorneID are not on the form.

    Subform container control SourceObject is T_OrderDetails - better to use a form as SourceObject.

    I don't understand what you are trying to do. What do you mean by 'default values for subform'? What is purpose of those two controls?

    Each order can be for only 1 product? In a conventional orders db, OrderDetails would be where products are selected to associate with an order. Each order could have many products. Not understanding your data structure. What do T_Order_Details records represent? Why are they linked to T_Orders?

    Product combobox is bound to Product_ID but the field in T_Orders is Product.

    What is a Thorne?
    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.

  6. #6
    tcox's Avatar
    tcox is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Oct 2015
    Posts
    46
    ThorneID is an identifier uses in the business to identify a product run.

    The goal here is to make an order form that checks out tooling for equipment.
    The two items circled are because I don't want to have to select those every time they are entered into the sub form because there are rare cases that a ThorneID will be ran on multiple machines.

    What do T_Order_Details records represent?
    The parts assembled onto a machine to produce a product (ThorneID) how many capsules are ran and who checked those parts out.
    For a part order these items need to be recorded:
    ThorneID
    Machine(s) parts and product (ThorneID) is ran on. The capsule size field is used to sort down the parts list.
    how much product those parts ran.
    who checked out the parts.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Having a subform pull value from a control on main form is tricky.

    Couple of ways to set dynamic default value for control on subform. They require code.

    Going to have to use a form object (not the table) for the subform and put code behind the subform.

    IMO, a manufacturing db is one of the hardest to design. Rather common topic in forum. Might want to do a search.

    Cannot replicate the issue with your db. I start a new Order and entered record in subform without difficulty.
    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.

  8. #8
    tcox's Avatar
    tcox is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Oct 2015
    Posts
    46
    Quote Originally Posted by June7 View Post

    Cannot replicate the issue with your db. I start a new Order and entered record in subform without difficulty.
    Thank you for looking into this.
    The issue arises as soon as one of the drop down boxes on the main form that is used as a default value in the sub form is selected.
    As soon as it is selected, the subform auto populates the default value, but the main order forms entries for product, date and capsule size go blank. I think this is because it makes a an entry as soon as the default value drop down box is selected.

    I think I'm going to need to learn vba code that delays making an entry until all info is on the form and a post record button is clicked.

  9. #9
    tcox's Avatar
    tcox is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Oct 2015
    Posts
    46
    looks like I have narrowed down the issue to using "after update" Requery was causing the behavior.
    Now I need to find a way for the sub form to capture value in the main form instantly without causing a new and blank record to be made.

  10. #10
    tcox's Avatar
    tcox is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Oct 2015
    Posts
    46
    sorry for the string of threads, but I have been making progress!
    I changed the requery to refresh and all is good, as long as I don't press the Enter key after typing in the data for ThorneID.
    pressing Enter causes a new order record to be created. Is there any way to turn off this behavior?

    Thanks
    -Tevis

  11. #11
    tcox's Avatar
    tcox is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Oct 2015
    Posts
    46
    !SOLVED!
    changing Cycle to Current Record and all is good!

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

Similar Threads

  1. Replies: 2
    Last Post: 05-16-2015, 02:34 PM
  2. Replies: 3
    Last Post: 09-27-2013, 11:50 AM
  3. SubForm makes Page Controls Disappear
    By EddieN1 in forum Forms
    Replies: 1
    Last Post: 02-12-2013, 07:37 PM
  4. Add existing entries to another entry
    By Fairlane in forum Forms
    Replies: 8
    Last Post: 10-08-2012, 10:05 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