Can someone explain to me why this code works, but it does not work when I uncomment
Here are the two SQL Statements
and
Obviously, it has something to do with the HAVING Clause.
Code:
Function GetCountOfRecs() As Integer
On Error GoTo err_GetCount
Dim strSQL As String
Dim intCount As Integer
intCount = ReturnSingleFieldData("qryCountOfMyDataAggregated", "CountOfID")
'intCount = ReturnSingleFieldData("qryActiveMyDataAgg", "CountOfID")
GetCountOfRecs = intCount
'debug.print "Count of Active Records = " & GetCountOfRecs
Exit Function
err_GetCount:
ErrBox "getting the count of active records in MyDataAggregated"
End Function
Here are the two SQL Statements
Code:
SELECT Count(MyDataAggregated.ID) AS CountOfID
FROM MyDataAggregated
GROUP BY MyDataAggregated.fInactive, MyDataAggregated.fSignedAndReady
HAVING (((MyDataAggregated.fInactive)=False) AND ((MyDataAggregated.fSignedAndReady)=True));
Code:
SELECT Count(MyDataAggregated.ID) AS CountOfID
FROM MyDataAggregated;