条件语句未按预期运行

3

=IIF(Fields!Date.Value = "", "Some Text", Fields!Date.Value)

我在报告中使用了以上语句,如果日期值为空,则返回"一些文本",但是如果日期字段有值,而不是返回日期,我得到了#error

我的理解是,如果满足条件,则返回"一些文本",否则返回Fields!Date.Value

为什么会出现错误呢?

1个回答

2

这样做就可以了

=IIF(Fields!Date.Value Is Nothing, "No Value", Fields!Date.Value)

IIF()语句的格式如下:

=IIF( Expression to evaluate,
         what-to-do when the expression is true,
         what-to-do when the expression is false )
  • Parameter1: 应该是一个布尔表达式。
  • Paremeter2: 当 Expressiontrue 时,将返回此值。
  • Paremeter3: 当 Expressionfalse 时,将返回此值。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接