Re: Suppress "You are about to delete... " message?
- From: "Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx>
- Date: Sat, 14 Jul 2007 12:35:35 +0800
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
--
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.
"Laurel" <FakeMail@xxxxxxxxxxx> wrote in message
news:OZuvWUcxHHA.1208@xxxxxxxxxxxxxxxxxxxxxxx
Thanks! Will be careful.
"Jeff Boyce" <nonsense@xxxxxxxxxxxx> wrote in message news:esC4MiXxHHA.536@xxxxxxxxxxxxxxxxxxxxxxxLaurel
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
"Laurel" <FakeMail@xxxxxxxxxxx> wrote in message news:%23%2351scXxHHA.1776@xxxxxxxxxxxxxxxxxxxxxxxI 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
.
- Follow-Ups:
- Re: Suppress "You are about to delete... " message?
- From: Laurel
- Re: Suppress "You are about to delete... " message?
- References:
- Suppress "You are about to delete... " message?
- From: Laurel
- Re: Suppress "You are about to delete... " message?
- From: Jeff Boyce
- Re: Suppress "You are about to delete... " message?
- From: Laurel
- Suppress "You are about to delete... " message?
- Prev by Date: Re: Continuous Forms Group Selection Counter
- Next by Date: Formating # of decimal places displayed in Textbox
- Previous by thread: Re: Suppress "You are about to delete... " message?
- Next by thread: Re: Suppress "You are about to delete... " message?
- Index(es):
Relevant Pages
|