Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count total AppendQuery

Status
Not open for further replies.

matrixindicator

IS-IT--Management
Sep 6, 2007
418
BE
Hello,

In my code I need the total number of records of a few queries. If I try this with an action query access mentioned that you can't do this with an append query. Is there a way, because you can view an append query in design or in datasheet view.

Code:
Count2 = DCount("*", "001_QA")
 
You either have to make them a SELECT query or a SELECT Count(*) with the same FROM WHERE/HAVING GROUP BY clauses.

But if you execute them like

CurrentDB.Execute "ActionQueryName"
CurrentProject.Connection.Execute "ActionQueryName"

do include the optional (long type)parameter along with that command and get that to a variable
Code:
Dim myRecordsAffected As Long
CurrentProject.Connection.Execute "ActionQueryName", myRecordsAffected

MsgBox myRecordsAffected
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top