Hey everyone,
I have a really simple button on a form that runs the following code:
DoCmd.RunSQL "DELETE tblACTT_Basic.* FROM tblACTT_Basic;"
DoCmd.RunSQL "DELETE tblACTT_Enhanced.* FROM tblACTT_Enhanced;"
Now, when I do this, it gives me the "Hey, y'know you're about to delete
"xxxx" records, you sure??" I'd like the application to "click yes" so the
end user does not get prompted with this. Is this possible?
Douglas J. Steele - 08 Nov 2006 18:51 GMT
Two ways:
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE tblACTT_Basic.* FROM tblACTT_Basic;"
DoCmd.RunSQL "DELETE tblACTT_Enhanced.* FROM tblACTT_Enhanced;"
DoCmd.SetWarning True
or (my preferred way)
CurrentDb.Execute "DELETE tblACTT_Basic.* FROM tblACTT_Basic;",
dbFailOnError
CurrentDb.Execute "DELETE tblACTT_Enhanced.* FROM tblACTT_Enhanced;",
dbFailOnError
The advantage of using the Execute method is that it will raise a trappable
error if anything goes wrong.

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> Hey everyone,
>
[quoted text clipped - 5 lines]
> "xxxx" records, you sure??" I'd like the application to "click yes" so the
> end user does not get prompted with this. Is this possible?
Mike - 09 Nov 2006 15:10 GMT
Thanks! that worked like a charm and I learned some new stuff. :)
> Two ways:
>
[quoted text clipped - 22 lines]
> > "xxxx" records, you sure??" I'd like the application to "click yes" so the
> > end user does not get prompted with this. Is this possible?
Roger Carlson - 08 Nov 2006 18:55 GMT
Two Solutions:
1) Use the Set Warnings to turn off the confirmation dialogs:
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE tblACTT_Basic.* FROM tblACTT_Basic;"
DoCmd.RunSQL "DELETE tblACTT_Enhanced.* FROM tblACTT_Enhanced;"
DoCmd.SetWarnings True
2) Use the Execute Method of the database object to run your queries:
Currentdb.Execute "DELETE tblACTT_Basic.* FROM tblACTT_Basic",
dbFailOnError
Currentdb.Execute "DELETE tblACTT_Enhanced.* FROM tblACTT_Enhanced",
dbFailOnError

Signature
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
> Hey everyone,
>
[quoted text clipped - 5 lines]
> "xxxx" records, you sure??" I'd like the application to "click yes" so the
> end user does not get prompted with this. Is this possible?