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....
Ernest GroggSecurity Management InfoSecAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
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.
Rey Obrero (Capricorn1)Commented:
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'")
Ernest GroggSecurity Management InfoSecAuthor Commented:
Good call, but gives me the error on BadgeNumber

That is for either way....
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

Ernest GroggSecurity Management InfoSecAuthor Commented:
also, note that I take out the 2nd "And" it it works just fine, just adding this doesn't seem to work?
Rey Obrero (Capricorn1)Commented:
<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" ???
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Is badgenumber numeric or text?

Jim.
Rey Obrero (Capricorn1)Commented:
if badgeNumber is text, did you try
                       
DLookup("BageNumber", "tblBadges", "BadgeNumber='" & Result1 & "' And Returned = 0  And BadgeType = 'Blue V Badge'")

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ernest GroggSecurity Management InfoSecAuthor Commented:
OK, gotcha.  Sorry, I misspelled the field in the table....

Sometimes....I could....well you know...
Rey Obrero (Capricorn1)Commented:
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..
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.