Delete query question

  • Thread starter Thread starter Neil
  • Start date Start date
N

Neil

Hello,

I have a delete query that I run when finding duplicate data. I make the SQL
string in my procedure and then execute it as follows:

CurrentDb.Execute strSQL, dbFailOnError

Is there any way of getting how many records I have deleted doing this?

TIA,

Neil.
 
Hello,

I have a delete query that I run when finding duplicate data. I make the SQL
string in my procedure and then execute it as follows:

CurrentDb.Execute strSQL, dbFailOnError

Is there any way of getting how many records I have deleted doing this?

TIA,

Neil.

I don't believe so.
Why not use
DoCmd.RunCommand strSQL
instead?
You will get a message with the number of records to be deleted and an
opportunity to cancel the deletions if you wish to.
 
Don't use CurrentDb() "in line" like that. Save its return value in a
variable, & use the variable:

dim db as database
set db = currentdb()
' then use db instead of CurrentDb()

To get the # of records affected by an action query:

db.execute ...
msgbox db.recordsaffected

Remember to de-allocate db when finished:

set db = nothing

HTH,
TC
 
Thanks TC,

I though it was the RecordsAffected property that I had to use but it
returned 0 every time until i used the variable. Now it works ok.

Neil.
 
Back
Top