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