What you want to do is tricky without writing a VBA function.
FieldName: (IIF([AAA]=-1,"Name",Null) + "/") & (IIF([BBB]=-1,"Name2",Null)
+ "/") & (IIF([CCC]=-1,"Name3",Null) +" /")
To strip the trailing "/" off you need something like the following.
IIF(Right((IIF([AAA]=-1,"Name",Null) + "/") & (IIF([BBB]=-1,"Name2",Null) +
"/") & (IIF([CCC]=-1,"Name3",Null) +" /")
,1)="/",Left((IIF([AAA]=-1,"Name",Null) + "/") &
(IIF([BBB]=-1,"Name2",Null) + "/") & (IIF([CCC]=-1,"Name3",Null) +" /")
,Len((IIF([AAA]=-1,"Name",Null) + "/") & (IIF([BBB]=-1,"Name2",Null) + "/")
& (IIF([CCC]=-1,"Name3",Null) +" /") )-1),Null)
Susan said:
I was able to nest the IIF statements, however it still doesn't function
exactly the way I want it to. Any suggestions? Here is the statement.
FieldName:IIF([AAA]=-1, "name", IIf ([BBB]=-1, "name2", IIF([CCC]=-1,
"Name3".
It does show if even one of the fields is =1. However, if all apply, I
need
all of the "then" statements to appear in this field, seperated by a
slash.
I have tried "and" and "or", neither work.
HanSolo said:
Not sure about how to literally have a checkbox appear in the query
results (as you stated, Access defaults to -1 or 0 for checked and
unchecked). But regarding multiple IIF statements, you can nest them
in this format:
IIF(argument,then,(IIF(,argument,then,else statement)))
I think that you can get up to about 7 nested IIF's. You may also want
to try using the "select" "case" features of visual basic.