Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / November 2006

Tip: Looking for answers? Try searching our database.

Newbie: By-passing confirmation dialog boxes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike - 08 Nov 2006 18:49 GMT
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?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.