Thread: iff function
View Single Post
  #2  
Old April 27th, 2004, 09:20 PM
Rick Brandt
external usenet poster
 
Posts: n/a
Default iff function

"debdeb" wrote in message
...
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.


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com