Link to home
Avatar of Ernest Grogg
Ernest Grogg

asked on

DLookup Missing Operator

DLookup("BageNumber", "tblBadges", "BadgeNumber=" & Result1 & " And Returned = No  And BadgeType = Blue V Badge")

Can't seem to figure this one out.  Tried all the different combinations with quotes but can't get it right....
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

DLookup("[BageNumber]", "tblBadges", "[BadgeNumber] = " & Result1 & " And [Returned] = False And [BadgeType] = 'Blue V Badge'")

assuming BadgeNumber is a numeric.   All the square brackets ( [ ] ) are for safety.  While nothing here explicitly needed it, it's best to always use them on field names.

Also you needed false for "no" and BadgeType is text, so it needed string delimiters on it.

Jim.
DLookup("BageNumber", "tblBadges", "BadgeNumber=" & Result1 & " And Returned = 'No'  And BadgeType = 'Blue V Badge'")


if returned is boolean type field

DLookup("BageNumber", "tblBadges", "BadgeNumber=" & Result1 & " And Returned = 0  And BadgeType = 'Blue V Badge'")
Avatar of Ernest Grogg
Ernest Grogg

ASKER

Good call, but gives me the error on BadgeNumber

That is for either way....
also, note that I take out the 2nd "And" it it works just fine, just adding this doesn't seem to work?
<also, note that I take out the 2nd "And" it it works just fine>

that is weird?????

can you do a compact and repair, then try again

also, is this correct field name "BageNumber" ???
Is badgenumber numeric or text?

Jim.
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
OK, gotcha.  Sorry, I misspelled the field in the table....

Sometimes....I could....well you know...
so,  BageNumber is BadgeNumber
if that is the case, why are you still looking for the "BadgeNumber" in the dlookup when you are already know it from the variable "Result1" ?

maybe you should look for other Field values, based on BadgeNumber, Returned and BadgeType  parameters..