Populating all fields in a table with the use of a subform

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Arli
    New Member
    • Sep 2008
    • 39

    Populating all fields in a table with the use of a subform

    I use Windows XP and Access 2003
    I have a table called tblProcessLine
    it contains the following fields:

    Autonumber1 PK
    Date
    WorkOrder
    Qty
    LoadNumber
    Timein
    TimeOut
    Shift
    Badge
    Rework
    Billets
    Pinwheel
    Trimtabs

    I have a main form that fills in the following fields:
    Date
    LoadNumber
    TimeIN
    TimeOut
    Shift
    Rework (yes/no)
    Badge

    I have a subform that fills in:

    WorkOrder
    Qty

    I need the WorkOrder row to also contain all the information in the main form as well as the subform. This is not happening. I get blank fields in the rows where the WorkOrder is populated. I was wondering if need VBA code to read and populate those fields.

    Any help would be great.
  • FishVal
    Recognized Expert Specialist
    • Jun 2007
    • 2656

    #2
    Hello, Arli.

    I guess both main form and subform are bound to your table.
    If so, then all you need is to put the table PK into Master and Child properties of the subform control.

    Regards,
    Fish

    Comment

    • nico5038
      Recognized Expert Specialist
      • Nov 2006
      • 3080

      #3
      Hmm, I would start with normalizing your table from tblProcessLine into tblProcessHeade r and tblProcessLine.
      Now the "Header" data doesn't have to be replicated and when using the "Header" as the main form, than Access will propose to link the OrderID of the Header as the linkage field to a sub form based on tblProcessLine.

      Best to check out the NorthWind.mdb sample database from Microsoft to see how the Order and Orderdetail is created and maintained.

      Nic;o)

      Comment

      • Arli
        New Member
        • Sep 2008
        • 39

        #4
        Originally posted by FishVal
        Hello, Arli.

        I guess both main form and subform are bound to your table.
        If so, then all you need is to put the table PK into Master and Child properties of the subform control.

        Regards,
        Fish

        I did this and still it does not work correctly. I still get the information from the main form on a single line, with the information from the WorkOrder subform on the next lines (AutoNumber numbers these lines). I need the following fields to cascade down into those lines (Date, TimeStart, TimeOut) as I will have use for these fields in other queries later on. When I put the fields I need in the master and child properties (i.e. AutoNumber1;Dat e;), I get an error stating that Date is not a part of the object.

        Please help :(

        Comment

        • nico5038
          Recognized Expert Specialist
          • Nov 2006
          • 3080

          #5
          Do you have two tables or one ?

          Nic;o)

          Comment

          • Arli
            New Member
            • Sep 2008
            • 39

            #6
            I changed it so that it is one table at this point.

            Thanks for your input.

            Comment

            • nico5038
              Recognized Expert Specialist
              • Nov 2006
              • 3080

              #7
              I would start with normalizing your table from tblProcessLine into tblProcessHeade r and tblProcessLine.
              This will allow automatic linking of the "Header" data with the "Line" data when using a Main and Sub form..

              Checkout the Northwind sample .mdb.

              Nic;o)

              Comment

              • Arli
                New Member
                • Sep 2008
                • 39

                #8
                That helped alot. Looking at the Northwind data base helped.

                Thanks

                Comment

                Working...