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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top