j
并且d
两者都评估相同的函数,但是当我If IsNull
用来捕获任何空值时,d 的值没有被正确评估。这是什么原因造成的?
Dim d As Integer
Dim j As Integer
j = DSum("Count", "qry_nihr_unique")
If IsNull(d = DSum("Count", "qry_nihr_unique")) Then
MsgBox "No records were found for the data criteria you entered"
GoTo ESub
Else
Me.un_p.Value = d
End If
Debug.Print "j = " & j
Debug.Print "d = " & d
j = 58
d = 0
回答后更新代码
Dim d
d = DSum("Count", "qry_nihr_unique")
If IsNull(d) Then
MsgBox "No records were found for the data criteria you entered"
GoTo ESub
Else
Me.un_p.Value = d
End If
在下面 HansUp 的回答之后,我相信这是写这个的最有效的方法。