Access Iif in syntax error

I keep getting an error on:

Food: IIF ([Event] In (“Orange”,“Apple Slice”,“Pineapple Slice”), “Fruit Group”)
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:
except for the space after IIF and the " (double quotes seems odd)

copy and paste this

Food: IIF([Event] In ("Orange","Apple Slice","Pineapple Slice"), "Fruit Group")
0
exp vgAuthor Commented:
Should I use single quotes instead of double?
0
Rey Obrero (Capricorn1)Commented:
and you need to add the false statement value of the IIF() function
the syntax is

IIf(expr, truepart, falsepart)


Food: IIF([Event] In ("Orange","Apple Slice","Pineapple Slice"), "Fruit Group", "False part value goes here")
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.

exp vgAuthor Commented:
I am still getting an error message.
0
Rey Obrero (Capricorn1)Commented:
<Should I use single quotes instead of double? > it should be double quotes

the double quotes you used in your original post is the one used by MS Word and access will not understand it.
0
Rey Obrero (Capricorn1)Commented:
upload a copy of your db.
0
Dale FyeCommented:
What is the error message and #?

 Seems strange that a field called [Event] would contain the name of a fruit or vegetable.  Are you sure that is the correct field?
0
Rey Obrero (Capricorn1)Commented:
- incorrect field name is irrelevant for the syntax error, as long as the field name is in the table

even if you made a mistake of selecting the field from the table, it will not throw any error, it will just return blank result



.
0
hieloCommented:
Try adding Eval() around the first expression:
 IIF( Eval([Event] In (“Orange”,“Apple Slice”,“Pineapple Slice”)), “Fruit Group”, "Veggie?")
https://support.office.com/en-au/article/IIf-Function-32436ecf-c629-48a3-9900-647539c764e3
0
PatHartmanCommented:
I'm not sure where you are going with this example.  It seems to have been dumbed down to make it easy to explain.  But, in the real world, you will almost certainly have more than one group and so a single IIf() isn't really going to solve the problem.

The best solution to give you flexibility and maintainability is to create a lookup table.  Use a left join to the lookup table and pick up the group name if a record is found.
0
exp vgAuthor Commented:
The double quotes may be the issue. Let me retry.
0
Rey Obrero (Capricorn1)Commented:
<The double quotes may be the issue. Let me retry.>

do the typing in QBE window.
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
exp vgAuthor Commented:
Thank you everyone - I have had not had the time today to revisit this - will do so as soon as I can. Appreciative of everyone's assistance.
0
exp vgAuthor Commented:
The quotes do seem to be the solution - when I type in Expression Builder I am able to save and do not get an error.

Is there another application I can use in substitute of the QBE since this is a small screen and the expression I will type will be lengthy.

Thank you.
0
Rey Obrero (Capricorn1)Commented:
you can use Notepad or Notepad++
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.