Capture number of records updated?

J

Jeff Hunt

We have several processes that we run on a daily or monthly basis that I am
trying to automate. Each one has a series of delete, append, and/or update
queries, sometimes as many as 15 per process. I am trying to find out if
there is a way to suppress the query messages but still capture how many
records each query impacted.

I know how to run the queries from code, and how to turn off the warnings
(DoCmd.SetWarnings False), but then I can't see how many records were
deleted/appended/updated. I need to see these totals to spot check them and
make sure there is not a problem. I would like to dump each query's number
of records to a form, so the process can run by itself but we can check the
number of records each query returned when the process is complete. Is this
at all possible?
 
J

Jeanette Cunningham

Hi Jeff,
use this method to run each query (outline notes only)
dim db as dao.database
set db = dbengine(0)(0)

strSQL = "your query string here"
db.execute, strSQL, dbfailonerror
debug.print dbrecordsaffected

the dbrecordsaffected will give you the count of how many records were
successfully deleted, updated etc.

Jeanette Cunningham
 

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

Top