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 / Forms Programming / July 2007

Tip: Looking for answers? Try searching our database.

Suppress "You are about to delete... " message?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Laurel - 13 Jul 2007 18:59 GMT
I have several lines of code that look like this.  Is there some way I can
suppress the message, "You are about to delete x row(s) from the specified
table."  etc.,,, Yes, No.

   ls_sql = "DELETE  from tblAcademics WHERE [student_id] = " _
       & rstClassList![Student_ID]
   DoCmd.RunSQL ls_sql
Jeff Boyce - 13 Jul 2007 19:06 GMT
Laurel

You can turn off the warning(s) Access gives.

NOTE -- IF YOU FAIL TO TURN THE WARNINGS BACK ON, YOU WILL NEVER KNOW WHEN
ACCESS IS FAILING!

I'd recommend something like:

   DoCmd.SetWarnings False
   DoCmd.RunSQL ls_sql

   DoCmd.SetWarnings True

AND I'd suggest adding

   DoCmd.SetWarnings True

in your 'exit' routine, plus ensure that even an error condition exits via
your exit routine, ensuring that the warnings get turned back on no matter
what happens.

(and I also created a simple macro to turn warnings back on if, despite my
every effort, they still manage to get turned off)

Regards

Jeff Boyce
Microsoft Office/Access MVP

>I have several lines of code that look like this.  Is there some way I can
>suppress the message, "You are about to delete x row(s) from the specified
[quoted text clipped - 3 lines]
>        & rstClassList![Student_ID]
>    DoCmd.RunSQL ls_sql
Laurel - 14 Jul 2007 04:17 GMT
Thanks!  Will be careful.

> Laurel
>
[quoted text clipped - 33 lines]
>>        & rstClassList![Student_ID]
>>    DoCmd.RunSQL ls_sql
Allen Browne - 14 Jul 2007 05:35 GMT
Laurel, an alternative approach is to use Execute rather than RunSQL:
   ls_sql = "DELETE  from tblAcademics WHERE [student_id] = " _
       & rstClassList![Student_ID]
   dbEngine(0)(0).Execute ls_sql, dbFailOnError

Advantages:
1. You don't need to turn setwarnings off.
2. It *does* give you a warning if the delete fails.

Details in:
   Action queries: suppressing dialogs, while knowing results
at:
   http://allenbrowne.com/ser-60.html

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> Thanks!  Will be careful.
>
[quoted text clipped - 35 lines]
>>>        & rstClassList![Student_ID]
>>>    DoCmd.RunSQL ls_sql
Laurel - 14 Jul 2007 16:39 GMT
great.  thanks
> Laurel, an alternative approach is to use Execute rather than RunSQL:
>    ls_sql = "DELETE  from tblAcademics WHERE [student_id] = " _
[quoted text clipped - 49 lines]
>>>>        & rstClassList![Student_ID]
>>>>    DoCmd.RunSQL ls_sql
 
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.