Getting fields for form from another table

PulseTeqUser

Registered User.
Local time
Today, 13:19
Joined
May 2, 2017
Messages
15
I have a table of orders which has the field Supplier. When I produce the Purchase order as a form based on the Orders table I want to be able to add the address details for the supplier from the Suppliers table. There is a relationship between Supplier in the Suppliers table and Supplier in the Orders table. I have set the Control source on the form to =[Suppliers]![Address1] but I get #Name on the form. What I am missing?

Thanks in advance
 
You can't reference a Field in a Table that way, in the Control Source...hence the error.

This kind of thing is usually done using DLookup().

=DLookup("Address1", "Suppliers", "Supplier ='" & [Supplier] & "'")

You could use a Combobox for the Suppliers, with the address Fields included, then assigning them to the appropriate Controls on the Form, using the Combobox AfterUpdate event, but you really should only include the Supplier in the Orders table, simply pulling up the address when needed, in Reports, other Forms, etc.

Linq ;0)>
 
The DLookup solution is what I need - thank you very much
 

Users who are viewing this thread

Back
Top Bottom