Autopopulate form field from another table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PRLIT
    New Member
    • Feb 2007
    • 12

    Autopopulate form field from another table

    First, let me just say that I've been looking at this site for help for awhile now. Thank you for all the help you given me over the past few months.

    Second, I'm creating a form in Access 2007. I have a customer ID field, customer name field, parts, time, cost.

    The customer name is part of the customer table while the rest of the data is part of the "order" table. Looking for the code that would autopopulate the customer name field based on the customer ID field (also in the customer table).
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Code:
    DlookUp("[Customer Name]", "Customer Table", "[Customer ID] = " & Me.[Customer ID])

    Comment

    • nico5038
      Recognized Expert Specialist
      • Nov 2006
      • 3080

      #3
      I would add a subform for the Customer fields and when the subform wizard asks for linking the subform select the proposed CustomerID as linking field.

      Nic;o)

      Comment

      • PRLIT
        New Member
        • Feb 2007
        • 12

        #4
        Thx Rabbit - perfect.

        Comment

        • Rabbit
          Recognized Expert MVP
          • Jan 2007
          • 12517

          #5
          No problem.

          Comment

          Working...