iff function

D

debdeb

I have a table where there are numbers stored for the
values. How do I get those numbers to print out the
corresponding words in a report. Example 1=yes 2=no
3=sometimes. I have the beginning, but how do I put the
rest in.....
Example if field name is Weather,
=IIf([weather]=1,yes)
 
R

Rick Brandt

debdeb said:
I have a table where there are numbers stored for the
values. How do I get those numbers to print out the
corresponding words in a report. Example 1=yes 2=no
3=sometimes. I have the beginning, but how do I put the
rest in.....
Example if field name is Weather,
=IIf([weather]=1,yes)

As long as the numeric values go from 1 to whatever and there aren't too
many of them you can use the Choose Function.

=Choose(YourField, "TextIf1", "TextIf2", "TextIf3", etc..)

I don't recall, but I think Choose has a limit though. You can also look
at the Switch() function. While either of these would likely be easier to
build (and debug) then nesting Immediate-Ifs I would actually create a
translation table and join to it in my query if there are more than just a
few choices.
 
P

PC Datasheet

Look at the Switch and Choose functions in the Help file. They are more
appropriate than the Intermediate If here.
 
Top