Get rid of "You are about to delete 1 row(s) from..." message

J

j

Is it possible to get rid of these messages from every time I run a query?
Thanks!

"You are about to delete 1 row(s) from..." message
"You are about to append 1 row(s) from..." message
 
A

Allen Browne

Yes. You can avoid them by turning SetWarnings off before you run the query,
but then you don't know if it worked fully, partially, or not at all.

A bettter solution is to use Execute. Details in:
Action queries: suppressing dialogs, while knowing results
at:
http://allenbrowne.com/ser-60.html
 
S

Sprinks

j,

You can disable modal warnings & messages by:

DoCmd.SetWarnings False

Error messages will still appear. At the end of your code, turn messages
back on:

DoCmd.SetWarnings True

Sprinks
 
T

Tony Toews

Sprinks said:
You can disable modal warnings & messages by:

DoCmd.SetWarnings False

Error messages will still appear. At the end of your code, turn messages
back on:

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
 
V

Vicky

Hi,
I have a simple solution. just change some options in the option feature
Open the query in design field
Go to Tools\Options
Go to Edit/Find Tab
Uncheck the "Record change" and "Action Queries"
Hope this can help :)
Vicky
 

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