Dlookup error

Coleman984

Registered User.
Local time
Today, 05:04
Joined
Jul 28, 2011
Messages
89
I'm new to access and have little idea how to lookup a name from an employee ID.

Below is the formula I'm trying but it is erroring out and I don't know how to fix it.

Can anyone help?

Employee Name: DLookUp("txtFName","tblEmployee","Criteria =" & [tblEmployeeAttendance.fkEmployeeID])

Below is the error.

The express you entered as a query parameter produce this error: 'The object doesn't contain the Automation object 'Criteria.''
 
You don't use the word "Criteria" in the criteria for the DLookup. You use the name of the field for which you are trying to find a match. So, assuming that the PK field of tblEmployee is something like EmployeeID, then the DLookup should be as follows (or similar);

DLookup("txtFName", "tblEmployee", "EmployeeID=" & [tblEmployeeAttendance].[fkEmployeeID])

This assumes the both EmployeeID and fkEmployeeID are numeric and that you are using this in a query that includes tblEmployeeAttendance as one of its tables.
 

Users who are viewing this thread

Back
Top Bottom