Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Sep 2006
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Forms and Subforms (2003)

    I've inherited this database -- it's got a PurchaseOrder form that's used to input data into two separate tables: Purchase Orders and PurchaseOrderLineItems. The PurchaseOrder table compiles the shipping details (to, from, who requested, terms, etc.); the LineItems table compiles the order contents (units, price, etc.). The PurchaseOrder form itself is linked to the PurchaseOrder table, and a LineItems subform (Continuous Forms view) to the LineItems table. The way it's supposed to work is that an autonumber is assigned to each order; each line item added to that order is given a number (starting at 1) and those two (order number and line item number) serve as primary keys for the LineItems table, so you end up with:
    tblPurchaseOrder
    PO# Details
    1041 aaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    1042 bbbbbbbbbbbbbbbbbbbbbbbbbbbbb
    tblLineItems
    L# PO# Details
    1 1041 ccccccccccc
    2 1041 ddddddddd
    1 1042 eeeeeeeeee

    In any case, I'm trying to copy/rebuild this on my own, but I can't figure out how to do it. So far I've had subforms that don't register the PurchaseOrder # and treat it always as 0 , which prevents multiple orders because of data redundancy; a subform that treats each new LineItem as a new PurchaseOrder; a subform that clears itself every time I go to the next PurchaseOrder; and a subform that doesn't even want to show up in FormView. But I'm looking back at the form I inherited and can't see what I'm doing differently. I just want to know how to build it

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Forms and Subforms (2003)

    The subform should be linked to the main form through the Link Child Fields and Link Master Fields properties of the subform as a control on the main form. In your example, both properties should be set to PO#. The easiest way to do this is to click in either of these properties and click the builder button (the ... on the right hand side). Access should propose the correct fields if the tables have been joined properly in the Relationships window.

  3. #3
    New Lounger
    Join Date
    Sep 2006
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Forms and Subforms (2003)

    The problem I'm running into now is that when I fill out the form and the subform and then continue on to the next form, the subform will remain the same. That is, all the LineItems I entered for PurchaseOrder 1041 will show up in PurchaseOrder 1042 -- I need the subform to reset with the form.

  4. #4
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Forms and Subforms (2003)

    As Hans mentioned, you need to check the Master/Child Links in the subform control; I'm betting they are blank. It should be the PurchaseOrder for both (or whatever your actual fieldnames are). This will automatically syncronize the subform with the mainform.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •