Text box in report - value based on control source

D

Dave

Hi:

I need the value of the text box to be "Yes" if the table field is
0, "No" if it is 1, and "NA" if it is 2. What is the best way to
accomplish this task? Thank you for your help.

Dave
 
D

Dale Fye

I like to use the Switch function for this. You'll find lots of developers
that like nested IIF( ) functions, but I find them too hard to read. Try:

ControlSource: =Switch([FieldName] = 0, "Yes", [FieldName] = 1, "No",
[FieldName] = 2, "NA", True, "Invalid")
 
K

KARL DEWEY

The nested IIF would be --
ControlSource: IIF([FieldName] = 0, "Yes", IIF([FieldName] = 1, "No",
IIF([FieldName] = 2, "NA", "Invalid")))

--
Build a little, test a little.


Dale Fye said:
I like to use the Switch function for this. You'll find lots of developers
that like nested IIF( ) functions, but I find them too hard to read. Try:

ControlSource: =Switch([FieldName] = 0, "Yes", [FieldName] = 1, "No",
[FieldName] = 2, "NA", True, "Invalid")

----
HTH
Dale



Dave said:
Hi:

I need the value of the text box to be "Yes" if the table field is
0, "No" if it is 1, and "NA" if it is 2. What is the best way to
accomplish this task? Thank you for your help.

Dave
 
D

Dave

I like to use the Switch function for this.  You'll find lots of developers
that like nested IIF( ) functions, but I find them too hard to read.  Try:

ControlSource: =Switch([FieldName] = 0, "Yes", [FieldName] = 1, "No",
[FieldName] = 2, "NA", True, "Invalid")
Exactly what I needed - thank you very much!! Worked great....

Dave
 

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