Suppressing delete warning

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

Guest

On my form I have a button, which runs code to delete records from a
temporary table:

DoCmd.RunSQL "DELETE myTMPtable.* FROM myTMPtable"

Is it possible to programmatically suppress the delete warning?

Thank you in advance for any tips!
 
Use the setwarnings command to false

Docmd.SetWarnings False
DoCmd.RunSQL "DELETE myTMPtable.* FROM myTMPtable"
Docmd.SetWarnings True

Don't forget to set the warnings back to true
 
Best solution:
dbEngine(0)(0).Execute "DELETE...", dbFailOnError

That generates no message, unless something goes wrong (e.g. a record could
not be deleted because someone is editing it.)
 
Back
Top