automatically change table value

JamieC

New member
Local time
Today, 13:05
Joined
Apr 22, 2006
Messages
7
Hi guys,

I'm having an issue I hope can be resolved with a macro but I don't exactly know how to fix it.

I have a table containing some fields with the following values:
1
2
3

When I open the report that gets it info from this table it prints me the values 1, 2 and 3.

Now I want the report to print me the values: YES, NO and N/A. So
1 = YES
2 = NO
3 = N/A

Is it possible to make something like this with a macro or do I have to use another way to get this result?
 
You could maybe use a nested IIF in the query

Code:
IIf([value] = 1, [value] & " " & "= Yes" , IIf([value] = 2, [value] & " " & "= No",  [value] & " " & "= N/A" ))

Col
 
alternatively, if you are not familiar with using code, you may create another table like:
id txt
1 Yes
2 No
3 N/A

and make a query with your main table that joined with this table with the field ID...
 
Hi -

Try the Choose() function. From the debug (immediate) window:

x = 2
? x & " = " & choose(x, "Yes", "No", "N/A")
2 = No

HTH - Bob
 
I'm not really familiar with IIf code in te query so I'm not sure how to use this...
I tried to use the code as raskew described it but that gives me an error on the last line ( 2 = No).
 
JamieC said:
I'm not really familiar with IIf code in te query so I'm not sure how to use this...
I tried to use the code as raskew described it but that gives me an error on the last line ( 2 = No).
Jamie -

'2 = No' is the output you get after processing the first two lines.

Try this in the debug window:
Type:
x = 2
Press enter.
Type:
? x & " = " & choose(x, "Yes", "No", "N/A")
Press enter.

You should be rewarded with:
2 = No

Bob
 

Users who are viewing this thread

Back
Top Bottom