Counting Records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to program a code in a form to run a query - then count the
number of records in that query.
I know how to run a query by this method:
Dim Inst As QueryDef
Dim strSQL As String
strSQL = " -- sql -- "
Set Inst = db.CreateQueryDef("", strSQL)
Inst.Execute

Thanks.
 
Hi,
you can execute a query with:

CurrentDb.Execute "yourquery",dbfailonerror

You can count within queries and tables with the dcount function:

Dcount("*","QueryName")

HTH
Good luck
 
Back
Top