show number of records updated

  • Thread starter Thread starter CJ
  • Start date Start date
C

CJ

I have a form which selects a 'source' table and a 'destination' table and
allows the user to select fields from the source table to update or insert to
the destination table. The form generates and runs SQL code and works well as
it stands, however I want to be able to put into a log the number of records
affected as reported when you get a message if setwarnings=true.

I have seen responses to similar questions when the query exists as an
object but not when it is run as code but since there is no query object I
cannot see how to use this.

At the moment the only solution I can see is to put the SQL code into a
temporary query object and then delete it after obtaining the reported
numbers but this seems a bit like using a sledgehammer to crack a nut!

Any suggestions will be much appreciated.
 
One way to do this, is to use the Execute method to run your action query.
Then you can simply use the RecordsAffected Property to get your number of
records. Look at the help file for more details and examples.
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
Spot on - did the job many thanks



Daniel Pineault said:
One way to do this, is to use the Execute method to run your action query.
Then you can simply use the RecordsAffected Property to get your number of
records. Look at the help file for more details and examples.
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
Back
Top