Supress warnings - Access 2003

A

Abay

Hello .. I am running a query from an event procedure and want to suppress
the warning messages which appear re: updating a table etc. Is there a way
to do this in the event procedure?

Also I just upgraded from Access 2000, and it allows the suppression of
warnings as an option, (tools, options), but I can't find a similar option
in 2003.

Any help would be much appreciated.

Abay
 
T

tina

in your VBA procedure:

DoCmd.SetWarnings False
<run your query here>
DoCmd.SetWarnings True

hth
 
A

Abay

Many thanks & apologies, should have figured that out ... your help is most
appreciated.

Abay
 
T

Tony Toews [MVP]

tina said:
DoCmd.SetWarnings False
<run your query here>
DoCmd.SetWarnings True

I prefer, if DAO, to use Currentdb.Execute strSQL,dbfailonerror
command instead of docmd.runsql. For ADO use
CurrentProject.Connection.Execute strCommand, lngRecordsAffected,
adCmdText

If you're going to use docmd.setwarnings make very sure you put the
True statement in any error handling code as well. Otherwise weird
things may happen later on especially while you are working on the
app. For example you will no longer get the "Do you wish to save your
changes" message if you close an object. This may mean that unwanted
changes, deletions or additions will be saved to your MDB.

Also performance can be significantly different between the two
methods. One posting stated currentdb.execute took two seconds while
docmd.runsql took eight seconds. As always YMMV.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top