From: David W. Fenton on
"Tony Toews [MVP]" <ttoews(a)telusplanet.net> wrote in
news:vioes592t6j1qaq4rh4im2s0tu3p87feus(a)4ax.com:

> Terry <Terry(a)discussions.microsoft.com> wrote:
>
>>When running an update query, Access displays a warning message
>>box and prompts for a response ("You are about to run an update
>>query that will modify data in your table").
>
> The problem with DoCmd.RunSQL is that it ignores any errors.
> Either of the following will display any error messages received
> by the query. If using DAO, use Currentdb.Execute
> strSQL,dbfailonerror.. For ADO use
> CurrentProject.Connection.Execute strCommand, lngRecordsAffected,
> adCmdText You can then remove the docmd.setwarnings lines.

But don't do either of the latter without an error handler!

That's why I wrote my RunSQL() function, as a drop-in replacement fr
DoCmd.RunSQL -- it's nothing but a wrapper around the Execute
command, with appropriate error handling. Use Google Groups to find
the code for it -- I've posted it a bazillion times.

> If you're going to use docmd.setwarnings make very sure you put
> the True statement in any error handling code as well.

I NEVER set it off. EVER. I think most experienced Access developers
would say the same thing. Dependence on it probably indicates you're
taking shortcuts (such as using menu commands with DoCmd.RunCommand)
where there are other more appropriate and more reliable methods to
accomplish the same thing.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/