Append query from code record count

  • Thread starter Thread starter CLM
  • Start date Start date
C

CLM

I have a form with the code of:

strQryName = "QApnd qspt 18th to tblData"

DoCmd.SetWarnings False
DoCmd.OpenQuery strQryName, acViewNormal

DoCmd.SetWarnings True

Is there a way to capture the number of records appended?
I know that the DoCmd.SetWarnings False turns off the
message box relaying number of records appended to the
user but is there a way to capture that info in the code
so that I can use it?
 
If you need the number of records affected before they are affected, you
could open a recordset in code, which contains only the SELECT part of
your action query, and look at its Rst.RecordCount proeprty. To get the
number of affected records after the fact, you could execute the query
using its querydef and check the .RecordsAffected property. You could
roll back the changes if you decided you don't want to update records,
too, using Jet transactions.
Pavel
 
Your suggestions worked great. Now I can run the query as
an SQL statement through a call to module code and capture
the results of the run and log it.

thanks for the assist.
 
Back
Top