Dlookup from a query

megatronixs

Registered User.
Local time
Today, 01:52
Joined
Aug 17, 2012
Messages
719
Hi all,

I wanted to use a query to get the results with DLookup like in the below. All I get is an error 3464 Data type mismatch.

Any clue where go wrong with the below?


Code:
strEmailEnrol = DLookup("[E-Mail Address]", "qry_email_address_enrol", "[Employee ID(1,679)] = " & Participant & "")

The query uses a linked excel file as the table, called "Active"

Greetings.
 
you dont put Dlookup in a query. The QUERY is the dlookup.

but, If employee ID is numeric then:
DLookup("[E-Mail Address]", "qry_email_address_enrol", "[Employee ID(1,679)] =" & Participant )

if a string , put quotes around it:
DLookup("[E-Mail Address]", "qry_email_address_enrol", "[Employee ID(1,679)] ='" & Participant & "'")
 
why would you have a field called
Employee ID(1,679)

why not just EmployeeID?
 
hi Ranman,
the field name comes from an excel file that is produced by a system, not much I can do about it :-(
This is the code that worked:
Code:
strEmailEnrol = DLookup("[E-Mail Address]", "Active", "[Employee ID(1,679)] = '" & Participant & "'")
Thanks a lot for :-)

Greetings.

(I ended up using the excel file called "Active" instead of the query)
 
Last edited:

Users who are viewing this thread

Back
Top Bottom