Reporting Services表达式字符类型'&'并不重合

时间:2015-09-14 19:17:33

标签: vba reporting-services

我在Reporting Services报告的其中一个文本框中有以下表达式:

=Parameters!Detalle.Value
    & IIF(Fields!Merchandiser.Value=False,"<b>Write Something: </b>" & FormatNumber(Sum(Fields!Amount1.Value, "Datasource") + Sum(Fields!Amount2.Value, "Datasource"),2) & "<br>",
    &"<b>Write Something: </b>" & Sum(Fields!Number.Value, "Datasource") & "<br>"

但我有以下错误: “textrun类型的对象”Textbox“的值表达式包含一个错误:[BC30277]字符类型'&amp;'与声明的数据类型“Object”不一致。

我认为问题在于我放置&amp;在我的条件内,但我不是100%肯定。

1 个答案:

答案 0 :(得分:0)

你有一个额外的&amp;在您的表达式中,ELSE语句是。它也缺少一个结束括号。

=Parameters!Detalle.Value & 
    IIF(Fields!Merchandiser.Value=False, 
      "<b>Write Something: </b>" & FormatNumber(Sum(Fields!Amount1.Value, "Datasource") + Sum(Fields!Amount2.Value, "Datasource"),2) & "<br>",
      &"<b>Write Something: </b>" & Sum(Fields!Number.Value, "Datasource") & "<br>"

这应该有效:

=Parameters!Detalle.Value & 
IIF(Fields!Merchandiser.Value=False,
    "<b>Write Something: </b>" & FormatNumber(Sum(Fields!Amount1.Value, "Datasource") + Sum(Fields!Amount2.Value, "Datasource"),2) & "<br>",
    "<b>Write Something: </b>" & Sum(Fields!Number.Value, "Datasource") & "<br>")