Have to ask for help, been stuck for too long...
I have two tables tblPersonnel and tblCosts. I'm trying to make a query which would return list of names from tblPersonnel and next to the names would return Cost from tblCosts based on country id. CountryID is pk in tblCosts and fk in tblPersonnel. Cost is numeric value but countryid text string.
This is what I got but it returns an error:
SELECT tblPersonnel.PerID, DLookUp("Cost","tblCosts","CountryID=" & tblPersonnel.CountryID) AS Expr1
FROM tblPersonnel;
Error message:
the expression you entered as a query parameter produced this error: the object doesn't contain the automation object xxxx
How this syntax should go?
EDIT: Yes, got it to work. Correct syntax:
SELECT tblPersonnel.PerID, DLookUp("Cost","tblCosts","[CountryId] ='" & [tblPersonnel].[countryId] & "'") AS Cst
FROM tblCosts INNER JOIN tblPersonnel ON tblCosts.CountryId = tblPersonnel.CountryId;