If Then

  • Thread starter Thread starter nl
  • Start date Start date
N

nl

In a report there'a a field called Type, which it's a
number, but instead of the number I want it to show a
word, example: Type = 7, instead of 7 I want it to
show "checked"

How can I do this?????

Thank you:)
 
If you have just a few "types", you can replace the "type"
field with a bound text box containing =iif
(type=7,"checked",iif(type=...)) nested to as many iifs as
you have types plus a final "unknown" value if the type is
null or a stray value not tested in the nested iif.
If the report draws from a table, you probably need to
have another field containing the word(s) you want to use
for each "type."
If the report draws from a query, you can build a lookup
table containing "type" values and equivalent text, and
bring the text into the report by joining that table into
the query via the "type" field.
hcj
 
In a report there'a a field called Type, which it's a
number, but instead of the number I want it to show a
word, example: Type = 7, instead of 7 I want it to
show "checked"

How can I do this?????

Several ways:

- Nested IIF statements as suggested by hcj. This can be slow and you
can't nest too deeply without getting expression errors.

- The Choose() function:

CHOOSE([Type], "type 1 value", "type 2 value", "type 3 value", <etc>)

- My preference: set up a small lookup table with two fields, the
numeric value and its meaning. On a Form you can put a combo box bound
to the numeric value but showing the text; or you can use a Query
joining this table to your main table to pick up the text.
 
Back
Top