编辑
而不是使用IIF语句s和其他人,我会推荐做以下事情:添加一个自定义函数到你的报告,去报告属性和代码标签。创建以下内容。要明确指出引发错误的字段,您可以将其更改为返回一个字符串,也许可以使用“#OOOOOOPS”,以便在报告中突出显示。
Public Function SafeDivision(ByVal top As Decimal, ByVal bottom As Decimal) As Decimal
If bottom = 0 Then
Return 0
Else : Return top/bottom
End If
End Function
添加此功能后,请转到表达式视图,查看您在哪里出现分割的所有字段。
=Code.SafeDivivision(CDbl(1.24), CDbl(0))
ORIGINAL
如果您运行Visual Studio中的报告,它告诉你哪些特定的文本/标签/场计算失败:您可以通过键入执行这个新创建的功能?这应该帮助找出其中的问题是从哪里来的,但你也可以确保你永远不会0分母看一下下面的代码执行除法...
//myBottom would be the value of the denominator
//myTop would be the value of the numerator
= IIF(myBottom <> 0, myTop/myBottom, "")
希望这对你有帮助,让我知道如果我可以尝试进一步帮助... – RSolberg 2009-08-04 16:05:45