| | |
|
|
|
If Then |
| message from nl on 1 Jun 2004 |
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:)
|
| hcj replied to nl on 1 Jun 2004 |
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
|
| John Vinson replied to nl on 01 Jun 2004 |
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.
John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
|
|
Archived message: If Then (Microsoft Access Forms)