Access IIF IN - Multiple Statements - Formatting Issue

exp vg
exp vg used Ask the Experts™
on
Hello

I have the following IIF statement. If I include just one IIF, this query works. If I include more than one, it does not. Please confirm where the formatting issue is.

Type: IIf([Event] In ("Birthday Party","Sleepover Party","Bake Sale"),"Child Event"),IIF([Event] In ("Movie Theater","Overseas Cruise","Dinner on the Town","Brunch"),"Adult Event")

This was created in notepad as suggested. The first event - child event - works alone. However when I add the second event - adult event - I get an error that I need to include quotations. I have reviewed the quotes, and all seems to be in order.

Thank you
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Ryan ChongSoftware Team Lead
Commented:
try:

IIf(  [Event] In ("Birthday Party","Sleepover Party","Bake Sale"),"Child Event" , IIF(  [Event] In ("Movie Theater","Overseas Cruise","Dinner on the Town","Brunch" ,"Adult Event")   )
Top Expert 2016
Commented:
you have closing parenthesis at the wrong place (after "Child event"), it should be at the end of te statement.


copy and paste this


Type: IIf([Event] In ("Birthday Party","Sleepover Party","Bake Sale"),"Child Event",IIF([Event] In ("Movie Theater","Overseas Cruise","Dinner on the Town","Brunch"),"Adult Event",""))
Distinguished Expert 2017
Commented:
You have also not included a final false path but Rey's solution addresses that by returning an empty string.  An alternative is to give it a value.

Type: IIf([Event] In ("Birthday Party","Sleepover Party","Bake Sale"),"Child Event",IIF([Event] In ("Movie Theater","Overseas Cruise","Dinner on the Town","Brunch"),"Adult Event","Event Not Found"))

Author

Commented:
Finally got this to work. Thank you everyone.

Author

Commented:
Thank you everyone.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial