Error "You Cancelled the previous operation"

G

Guest

WHen running a DLOOKUP function in a module I get the above error. I cannot
see where I've mis-coded anything and can't see anything different in this
code than in other code where the function works properly.

I am trying to retrieve the "Rate" from "tblPayRate" based on the "Crew"
field in "rstPay". My code is:

curInRate = DLookup("Rate", "tblPayRate", "Crew = " & [InCrew])

What might cause this error message?

Thanks
 
K

Ken Snell [MVP]

The error that you get is common when the DLookup (same for other domain
functions) contains invalid syntax in the expression or contains reference
to a field that does not exist in the table.

Is Crew a text field in tblPayRate table? Assuming that it is, delimit the
InCrew value with ' characters:
curInRate = DLookup("Rate", "tblPayRate", "Crew = '" & [InCrew] & "'")
 
G

Guest

Thanks Ken. Delimiting the "InCrew" field did the trick. I t hink I ran
into this before but forgot about it. Thanks again.

Ken Snell said:
The error that you get is common when the DLookup (same for other domain
functions) contains invalid syntax in the expression or contains reference
to a field that does not exist in the table.

Is Crew a text field in tblPayRate table? Assuming that it is, delimit the
InCrew value with ' characters:
curInRate = DLookup("Rate", "tblPayRate", "Crew = '" & [InCrew] & "'")

--

Ken Snell
<MS ACCESS MVP>

Carl said:
WHen running a DLOOKUP function in a module I get the above error. I
cannot
see where I've mis-coded anything and can't see anything different in this
code than in other code where the function works properly.

I am trying to retrieve the "Rate" from "tblPayRate" based on the "Crew"
field in "rstPay". My code is:

curInRate = DLookup("Rate", "tblPayRate", "Crew = " & [InCrew])

What might cause this error message?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top