Reputation: 457
I want to display the address of a customer (contact in my database) on a form that displays other basic information about customers. The address comes from an address table keyed on contact_id. I have tried a number of ways - =trim(address!address_line_1)
in the field's control source is one such.
Another failed attempt: = [address]![address_line_1] where [address]![contact_id] = [forms!contacts1!contact_id]
. This one caused a #Name?
error.
I am also unsure how to relate the control source query to the selected contact_id.
Any thoughts on how to display address details on a form showing other basic contact details for a particular customer would be much appreciated.
Upvotes: 0
Views: 142
Reputation: 1959
Here is what you need to do --
Surround the dbField name with quotes "[address_line_1]"
Surround the tblName with quotes "[address]"
Surround ContactID with quotes "[contact_id]= '"
If ContactID is a string, then add a preceeding & trailing single-quote If ContactID is numeric, remove the single-quotes from example
=DLookUp("[address_line_1]","[address]", _
"[contact_id]= '" & [Forms]![contacts1]![contact_id] & "'")
Upvotes: 1