Counting records with a Null field

So I have this code that looks in the [CanDate] field and tries to find all records where it is Null. My problem is that I have 3 records that are Null, but this is only finding 1. Can anyone suggest why this is possible?

Here's my code

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

      

+3


source to share


1 answer


If you just want a simple account, you might want to consider the function DCount

...



CanCount = DCount("*", "tblGroupHeader", "CanDate IS Null")

      

+4


source







All Articles