Dlookup Problems

  • Thread starter Thread starter Ross
  • Start date Start date
R

Ross

Guest
I am using the DLookup function in a form in the following context:
varX = DLookup("[Foreman]", "LabourNormalRate", "[CompanyName] = " & ContractorName(X))

Unfortunatly, it does not accept the last bit, claiming that there is a missing operator. Any help would be much appriceated

Ross
 
I don't know for sure, but you could try this:

varX = DLookup("[Foreman]", "LabourNormalRate", "[CompanyName] = '" & ContractorName(X) & "'")
 
Similarly, you could try
DLookup("[Foreman]", "LabourNormalRate", "[CompanyName] = """ & ContractorName(X)) & """"

as i would assume ContracterName is a text field, it needs quotes around it. The double quotes is treated as a literal single quote, rather than a funcitonal quote (which ends the quotation). That should work.
 

Users who are viewing this thread

Back
Top Bottom