Report column based on condition

V

Veli Izzet

Hi all,

I have a Report based on Query1. Query1 contains (among other fields)
two Yes/No fields, which are mutually exclusive.

I want to output two different texts respectively if any of these
conditions are met. If none of the conditions are met, that column is to
be blank.

In English:

If Field1=Yes print "Text1" if Field2=Yes print "Text2" If both are No
print blank.

Thanks for help.
 
A

Allen Browne

Set the Control Source of your text box on the report to:
=IIf([Field1], "Text1", IIf([Field2], "Text2", Null))
 
N

Nikos Yannacopoulos

Veli,

Yes/No fields return 0 for False, -1 for True in a mathematical
expression. Exploit this behaviour in a Choose function, like:

=Choose(1-[Field1]*1-[Field2]*2,"","Text1","Text2")

in the report control's ControlSource property.

HTH,
Nikos
 
V

Veli Izzet

Thanks Nikos,

I tried Allen's version and it worked. I will keep your version for
future use.
 
D

DavidWang\(??\)

anyone can give me some stories about bill gates, and other specialists on
computer?
Best Regards
David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top