开发者

ReportViewer IIf expression in text box returns #ERROR

I'm using ReportViewer for work and I'm trying to get an IIf expression to work with a few text boxes that are using FormatCur开发者_C百科rency(). The reason I needed an IIf statement in the first place was because occasionally on this report, there will be null parameters. The example here is a shipping box that may or may not have a value. If it has a value, say 15, it will format correctly to $15.00. If it doesn't have a value it returns #ERROR. Obviously this won't do.

Here is one IIf statement I'm using on a different report that works totally fine (sets the visibility of a text box):

=IIf(Fields!DATASET_NAME.Value.ToString() <> "DELETE", True, False)

Here is the one that's not working:

=IIf(Parameters!ShipAmt.Value.ToString() <> "", FormatCurrency(Parameters!ShipAmt.Value,2), "")

The IIf seems to work because if I enter a value it will still format correctly, but without a value it still returns #ERROR. Any ideas?


Calling ToString() on a null value goes Kaboom. Try IsNot Nothing instead.

But I think the real answer is here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜