Just for my own interest I tried the 3 methods on another postcodes table with over 2.6 million records to compare the times taken
Method 1 - using 2 aggregate queries combined with a cartesian join - took <3 seconds
Code:
Query1A: SELECT Count(Table1.FieldName) AS CountAll FROM Table1;
Query1B: SELECT Count(Table1.FieldName) AS CountConditionTrue FROM Table1 WHERE Condition=True;
Cartesian join: SELECT Query1A.CountAll, Query1B.CountConditionTrue FROM Query1A, Query1B;
Method 2 - using DCount - took 9 seconds - much longer as I expected
Code:
SELECT DCount("*","Table1") AS CountAll, DCount("*","Table1","Condition=True") AS CountConditionTrue;
Method 3 - single query using aggregate functions - took 4 seconds
Code:
SELECT Count("*") AS CountAll, Sum(IIf([InUse]=True,1,0)) AS CountInUse FROM Table1;
I was surprised to find Method 1 was faster than Method 3
I also thought it worth trying ...
Method 4 - which combines methods 1 & 3 - using 2 aggregate function queries combined using a cartesian join - it took 8 seconds
Query4A: SELECT Count("*") AS CountAll FROM Table1
Query4B: SELECT Count("*") AS CountConditionTrue FROM Table1 WHERE Condtion=True
Cartesian join: SELECT Query4A.CountAll, Query4B.CountConditionTrue FROM Query4A, Query4B;[/CODE]
All methods work & give correct answers. HTH somebody else trying to decide which method to use