Delete records without a confirmation message

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In a VBA program, I'm currently using a RUNSQL statement with a "DELETE *
FROM MyTableName WHERE ColumnName=UserName".

Unfortunately, this gives a message to users like "Do you want to confirm to
delete X number of records?"

How can we get around / avoid this prompt for users?

Do I need to use DAO instead of SQL?

If yes, do you have a code example using DAO to find all the records then
delete them? The Find. Move Next. Delete syntax seems much more heavy & not
documented in the Access Help compared to the simplicity of SQL.
 
Try executing the SQL string like this:
strSql = "DELETE FROM MyTableName WHERE ColumnName='UserName';"
dbEngine(0)(0).Execute strSql, dbFailOnError

This should give you no message, unless an error occurs (at which point it
aborts).
 

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

Back
Top