所以我有这个代码在[CanDate]字段中查找并尝试查找它为Null的所有记录。我的问题是我有3条记录是空的,但它只发现1.有人能说明为什么会这样吗?
这是我的代码
Set rsCanCounter = db.OpenRecordset("Select * from tblGroupHeader Where CanDate IS NULL", dbOpenDynaset)
canCount = rsCanCounter.RecordCount
If canCount = 0 Then
txtOpenAction.Value = 0
Else
txtOpenAction.Value = canCount
End If
答案 0 :(得分:4)
如果您只需要一个简单的计数,您可以考虑DCount
函数...
CanCount = DCount("*", "tblGroupHeader", "CanDate IS Null")