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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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",""))
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.
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.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Rey Obrero (Capricorn1)Commented:
IIf([Event] Like "*Walk*","Walking",IIf([Event] Like "*Out*","OUTDOORS",[Event]))

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.
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.
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.
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?
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].
Rey Obrero (Capricorn1)Commented:
copy this and paste

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