Access - IIF with '*Like*' Statements

I would like to use an update query, with the '*Like*' formatting to update column entries that have a component of the main category I am updating to.

For example:

IIf([Event] In ("*Walk*"),"Walking",IIf([Event] In ("*Out*"),"OUTDOORS"))

So anything that has 'walk' will be updated to main category 'WALKING' (i.e. Walking, Walkout, Walkathon. This applies to anything with out, will be updated to main category "OUTDOORS."

Thank you.
exp vgAsked:
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.

Rey Obrero (Capricorn1)Commented:
try

IIf([Event] Like "*Walk*","Walking",IIf([Event] Like "*Out*","OUTDOORS",""))
0
exp vgAuthor Commented:
Almost there. How can I specify that if it is not within these two categories to leave it as is. Now, if a cell value is not Walking or Outdoor, it changes it to a blank.

Thank you.
0
exp vgAuthor Commented:
I tried removing the "" at the end of the statement as well, and this did not work. This statement turns any value other than the two indicated updates into blank.

Thanks.
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.

Rey Obrero (Capricorn1)Commented:
IIf([Event] Like "*Walk*","Walking",IIf([Event] Like "*Out*","OUTDOORS",[Event]))
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
Rey Obrero (Capricorn1)Commented:
you need to add the option if any of the expression is not met, in this case default to the content of the [Event] field.
0
exp vgAuthor Commented:
Let me clarify, the remaining fields are multiple entries (i.e. sleeping, hiking, swimming, etc.), so there is not just one additional default.

Is there a way to indicate to leave it as is if the cell does not fall into walking or outdoors?

Hope this makes sense.
0
exp vgAuthor Commented:
Hmm - just not getting this to work - tried putting [Event] at the end - and now no changes are being made.

Do I only need to put [Event] once at the end for all the IIF statements?

Thanks.
0
Rey Obrero (Capricorn1)Commented:
<Is there a way to indicate to leave it as is if the cell does not fall into walking or outdoors?>

did you try my last post?
0
PatHartmanCommented:
That's what Rey's expression does.  The false path of the second IIf() says to replace [Event] with the value currently in [Event].
0
Rey Obrero (Capricorn1)Commented:
copy this and paste

IIf([Event] Like "*Walk*","Walking",IIf([Event] Like "*Out*","OUTDOORS",[Event]))
0
exp vgAuthor Commented:
Got this to work - thanks so much.
0
exp vgAuthor Commented:
Thank you.
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.