Reputation: 457
I want to display various customer (contact) details in a text box on a form. These include address details. I recently (today) asked a similar question to this, and got a great answer - use DLookUp. =DLookUp("[address_line_1]","[address]", _
"[contact_id]= '" & [Forms]![contacts1]![contact_id] & "'")
This works well for one field (in the above case address_line_1
). I'd like to now show the city, country, and post/zip code, concatenated, and on one line. I have tried a variation of the above code, but the documentation for DLookUp is clear that it only works on one field, so did not work for me: =DLookUp("[city]+[country]+[postcode]","[address]", _
"[contact_id]= & [Forms]![contacts1]![contact_id])
(the `contact_id' is auto generated int).
Any thoughts please?
Upvotes: 0
Views: 84
Reputation: 91366
You can use a number of SQL-like statements for the data to be returned. The concatenation operator in MS Access is &, not +. Concatenating with + can return null, for example, Null + Value = Null.
DLookUp("[city] & [country] & [postcode]","[address]", _
"[contact_id]=" & [Forms]![contacts1]![contact_id])
Upvotes: 1