hi
I have a loop in VBA code that needs to retrieve the number of records in a Totals Query on each loop iteration. Between each iteration, changes have been made to the underlying table, so I need to retest the number of records in the Totals Query with each loop. I currently use DAO to save the QryDef As TempTotalsQry, then use DCOUNT("X", "TempTotalsQry") to access the number of records in the query, then delete the QryDef.
My question is this: Is there any way to get these counts by using SQL embedded in the VBA, not saved queries?? For what it's worth, the SQL is "SELECT t.X FROM Tbl1 t GROUP BY t.X".
thank you in advance
Vicky
I have a loop in VBA code that needs to retrieve the number of records in a Totals Query on each loop iteration. Between each iteration, changes have been made to the underlying table, so I need to retest the number of records in the Totals Query with each loop. I currently use DAO to save the QryDef As TempTotalsQry, then use DCOUNT("X", "TempTotalsQry") to access the number of records in the query, then delete the QryDef.
My question is this: Is there any way to get these counts by using SQL embedded in the VBA, not saved queries?? For what it's worth, the SQL is "SELECT t.X FROM Tbl1 t GROUP BY t.X".
thank you in advance
Vicky