Text box in report - value based on control source

  • Thread starter Thread starter Dave
  • Start date Start date
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
 
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")
 
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
 
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
 
Back
Top