Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

expression help

Status
Not open for further replies.

sds814

Programmer
Feb 18, 2008
164
US
I wanted to multiply a value by 100 if the Field!FieldNameDescription was equal to "ABC" and ReportFieldValue has a value, but I keep on getting #ERROR.

Here is the code:
Code:
=IIF(Fields!FieldNameDescription.Value = "ABC" AND Fields!ReportFieldValue <> Nothing, CStr(CInt(Fields!ReportFieldValue.Value * 100)), Fields!ReportFieldValue.Value)

Thanks for the help.
 
Why are you returning two different data types, a string and an int ?

The iif evaluates better if it sees this...
((Fields!FieldNameDescription.Value = "ABC") AND (Fields!ReportFieldValue <> Nothing)), don't ask me why, I just tried a perfectly good set of ORs in some similar code and it would only execute them if each individual part of the expression evaluated to a boolean...
 
The CStr(CInt(Fields!ReportFieldValue.Value * 100)) I found on a post. So thats why I converted it into string. Thanks for recommending the change in the if statement clause.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top