Query syntax on where clause Using 3 IIF

Access 2010

I have in  a where clause for a field:
Fee_Charged

IIf(Like "Both*","Yes","No") or IIf(Like "Yes*","Yes","No")  or IIf(Like "No*","Yes","No")

I want records to be returned if the Value  "Both" or "Yes" or "No"

If it sees those Values return "Yes" otherwise "No"


Thanks
fordraiders
LVL 3
FordraidersAsked:
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.

NorieVBA ExpertCommented:
Are you sure you need IIf?

Wouldn't the WHERE criteria be more like this?

Like "Both*" Or Like "Yes*" Or Like "No*"
0
Dale FyeCommented:
How about a criteria that looks like:

IIF([Fee_Charged] IN ("Both", "Yes", "No"), "Yes", "No")
0

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
FordraidersAuthor Commented:
the wild card is for people who may add additions to criteria...like.

"Both-Sent"
"Yes-Sent"
"Yes-Later"
etc...
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Dale FyeCommented:
Ok, so this field is free text entry.  Any chance the users would simply type "Y" or "N"?

Free text entry are hard to set defined criteria for, but I would generally create a small function for this.  
1. I'm still not sure why you would want to return a "Yes" if the value is like "No*".
2. I'm also a bit confused, you start out indicating this is in a where clause for the [Fee Charged].  So, are you interested in adding a computed column to your query, or simply filtering on the [Fee Charged] field?
0
NorieVBA ExpertCommented:
Fordraiders

Each of the Iifs in your original expression will return a string and the overall result will be a type mismatch error.
0
FordraidersAuthor Commented:
Thanks..ended up using below...thanks for helping.

Service_Charge: IIf([Fee-Implemented] Like "Both*" Or [Fee-Implemented] Like "Yes*","Yes","No")
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.