• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 550
  • Last Modified:

Dlookup in a query or vba

I think this is a pretty remedial question but it is doing my head in...  I have two tables I have a contacts table with a unique identifier called Contact_Id.  I use that in other tables.  Now, I am trying to do a dlookup to send a subject line for Outlook and the dlookup is returning the first value in the contacts table for all records.

dim Employ as string

What I have is  Employ = DLookup("[firstname]", "tbl_contacts", "[contact_id] = contact_id")

The query it is referencing is another table that has the contact_ID in it.  What I want is the unique first name of each contact is returned.  What I am getting is the first name in the table being returned for all records.  The Contact_ID is a number.


1 Solution
Nico BontenbalCommented:
You need to do something like:
DLookup("[firstname]", "tbl_contacts", "[contact_id] = " & contact_id)

mtrussellAuthor Commented:

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now