Error with Dlookup

S

sharontodd

I am using dlookup to check to see if an invoice number has already been
used. After creating the number (mynumber - the date and a number after it)
for an order, I use

exists = dlookup("[CustomerID]", "Orders", "[OrderId] =" & mynumber)

then check if exists=null

I keep getting "Syntax Error (missing operator) in query expression
'[OrderId]=2010 Apr 29-1' " for the dlookup line.

What is the problem? THANKS

Sharon
 
J

JimBurke via AccessMonster.com

It sounds like the OrderID field is a text value, based on the way you're
describing it. If so then you need to put it in quotes:

"[OrderId] = '" & mynumber & "'"

That's a single quote followed by a double quote after the '=', then a single
quote insode two double quotes at the end.
I am using dlookup to check to see if an invoice number has already been
used. After creating the number (mynumber - the date and a number after it)
for an order, I use

exists = dlookup("[CustomerID]", "Orders", "[OrderId] =" & mynumber)

then check if exists=null

I keep getting "Syntax Error (missing operator) in query expression
'[OrderId]=2010 Apr 29-1' " for the dlookup line.

What is the problem? THANKS

Sharon
 

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