Friday, February 24, 2012

Iif Statment, IsNumeric, FormatCurrency

I noticed that regardless of the IsNumeric evaluation, the
Formatcurrency still fires. If I remove the FormatCurrency, and just
display the data, no problem. With the FormatCurrency in place, I get
an #error in the field if it is Alpha, but the proper information if it
is Numeric.
Example:
Iif(IsNumeric(Fields!item1.Value),FormatCurrency(Fields!item1.Value),"")
Has anyone else seen this before? If so, is there a workaround or is
there a problem with my logic?Howdy,
Both branches of the IIF function are evaluated without regard to the
logical expression. IIF just picks one of the evaluations to return.
(search this group for 'divide by zero error with iif' for more details
on the practicalities of this function)
Try something along the lines of
FormatCurrency(Iif(IsNumeric(Fields!item1.Value),Fields!item1.Value,-1))
HTH,
Sean G.|||Sean G.,
Thanks, I appreciate the assistance.
-Mal

No comments:

Post a Comment