Count all records in a query?

jmc86@mac.com

New member
Local time
Yesterday, 20:43
Joined
May 27, 2017
Messages
5
How do I count all records in a query to include null values?
 
What have you tried?
Null values in what?

Typical usage
Code:
SELECT Count(ProductID) AS NumberOfProducts FROM Products;
 
I tried to trick the null data because when I run the original count query all null data comes back as zero. Obviously, that didn't work and it still returned zero.

SELECT Reviwshttable.[ID], Reviwshttable.[Claimnum], Reviwshttable.[Precall], Count(Reviwshttable.Precall) AS CountOfPrecall, IIf([Precall]>-1,CInt(1),CInt(0)) AS [Pre Call Totl Count]
FROM Reviwshttable
GROUP BY Reviwshttable.[ID], Reviwshttable.[Claimnum], Reviwshttable.[Precall], IIf([Precall]>-1,CInt(1),CInt(0));
 
To count all records in a query, you can use
Code:
DCount("*"."queryName")

Or to count those records matching filter criteria 'strCriteria', use

Code:
DCount("*"."queryName".strCriteria)
 
You could use this too:

SELECT [ID], [Claimnum], [Precall], Count(*) AS [Pre Call Totl Count]
FROM Reviwshttable
GROUP BY [ID], [Claimnum], [Precall]
 

Users who are viewing this thread

Back
Top Bottom