我对值和空值的总和有疑问。无论有空字段,我想要实现的是总和的值。这是我的代码形式:
Public Sub projectname_Change()
Me.total1_n = DSum("SumBudgeted_amount2", "second_q")
Me.total2_n = DSum("SumBudgeted_amount2", "second_q2")
Me.total3_n = DSum("SumBudgeted_amount2", "second_q3")
Me.total4_n = DSum("SumBudgeted_amount2", "second_q4")
End Sub
有空值 second_q 区域。即使一个字段有值,因为 o 为空值,程序也会出错。我试图添加
Me.total1_n = DSum("SumBudgeted_amount2", "second_q", [Nz(second_q,[0])])
所有 second_qs 末尾的代码,还尝试了 IIf(IsNull... 代码。但是,它们不起作用。请帮我解决这个问题。