IIF in expersion builder (multiple)

bradgerb

New member
Local time
Today, 14:54
Joined
Oct 17, 2017
Messages
3
Hi and thank you for taking the time to help out.
I am trying to build an expression that has multiple IIF then needs and I don't even know if its possible
I can get it to work with one expression
Pack Day:IIF([dayid]=1,"Tuesday","")
works fine but here is where I need help
how do I do it with more then one iif

meaning
if dayid = 1 then Tuesday
if dayid = 2 then Wed
if dayid = 3 then Thur
and so on

I cant figure out (or is it even possible) how to have more then one IIF then in the expression builder.

any help will do and please if possible show me an example of the code

thanks!!!!!

Brad
 
you can use if

iif(dayid=1,"Tuesday",iif(dayid=2,"Wednesday",iif(.....)))

or if these are a number range, use the choose function

choose(dayid,"Tuesday","Wednesday",....)

but better to have a separate table populated with dayid and the day description, then simply join on it in a query
 
CJ that worked thank you thank you thank you!!
 
no need to test it:

WeekDayName([dayID], False, 3)
 
the other function that can be used is the switch function - the access sql equivalent of the case statement

switch(A=1,"val1",A=5,"val2",.....)
 

Users who are viewing this thread

Back
Top Bottom