By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,499 Members | 829 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,499 IT Pros & Developers. It's quick & easy.

SetWarnings False does not work

P: n/a
Hello --

After I run a macro which refreshes test data, running the app results in
warnings like
"You are about to delete .. records ..."

The macro contains pairs of
DELETE FROM table WHERE column Like "_*"
and
INSERT INTO table SELECT * FROM TESTdata

Use Transaction is set to "No"

Nowhere in my code do I have
DoCmd.SetWarnings True

At the beginning of the app I have
DoCmd.SetWarnings False

Does anyone know how Warnings get turned on?
Thanks for any help.

Larry Mehl
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.562 / Virus Database: 354 - Release Date: 1/16/2004
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi:

I don't know if its conventional to copy other peoples reply to questions, but the
following reply was sent to me regarding almost exactly the same issue:
I have W98 and Access 2000, and am running a fairly complex application with all sorts of
delete and append queries. These queries run in background on my system, and make no fuss
when they execute. I am now moving the application to another system which has Windows XP
(Home) and Access 2003 (or possibly 2002). When it runs on the new system all sorts of
irritating warnings pop up (delete queries for example) and interrupt the whole process.
How do I switch these OFF? I cant find the settings to do this.
These are somewhere in the Tools >> Options possibly Edit/Find at least in A97. But
this is not your best place to make this change. This is the quick and dirty fix.
Standard blurb follows:

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 wierd 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


"L Mehl" <me*********@cyvest.com> wrote:
Hello --

After I run a macro which refreshes test data, running the app results in
warnings like
"You are about to delete .. records ..."

The macro contains pairs of
DELETE FROM table WHERE column Like "_*"
and
INSERT INTO table SELECT * FROM TESTdata

Use Transaction is set to "No"

Nowhere in my code do I have
DoCmd.SetWarnings True

At the beginning of the app I have
DoCmd.SetWarnings False

Does anyone know how Warnings get turned on?
Thanks for any help.

Larry Mehl
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.562 / Virus Database: 354 - Release Date: 1/16/2004


Nov 12 '05 #2

P: n/a
Hi John --

Thanks. I don't think Tony will mind. You attributed the answer to him.

I have started using Currentdb.Execute strSQL,dbfailonerror command instead
of >docmd.runsql.

I don't want ACCESS to display "Do you wish to save your changes" messages
and prefer to use validation of fields before I allow a user out of a
process.

Larry
"John Baker" <Ba******@Verizon.net> wrote in message
news:nr********************************@4ax.com...
Hi:

I don't know if its conventional to copy other peoples reply to questions, but the following reply was sent to me regarding almost exactly the same issue:
I have W98 and Access 2000, and am running a fairly complex application with all sorts ofdelete and append queries. These queries run in background on my system, and make no fusswhen they execute. I am now moving the application to another system which has Windows XP(Home) and Access 2003 (or possibly 2002). When it runs on the new system all sorts ofirritating warnings pop up (delete queries for example) and interrupt the whole process.How do I switch these OFF? I cant find the settings to do this.


These are somewhere in the Tools >> Options possibly Edit/Find at least in A97. Butthis is not your best place to make this change. This is the quick and dirty fix.Standard blurb follows:

I prefer, if DAO, to use Currentdb.Execute strSQL,dbfailonerror command instead ofdocmd.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 inany error handling code as well. Otherwise wierd things may happen later onespecially 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 meanthat unwanted changes, deletions or additions will be saved to your MDB.

Also performance can be significantly different between the two methods. One postingstated currentdb.execute took two seconds while docmd.runsql took eight seconds. Asalways 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


"L Mehl" <me*********@cyvest.com> wrote:
Hello --

After I run a macro which refreshes test data, running the app results in
warnings like
"You are about to delete .. records ..."

The macro contains pairs of
DELETE FROM table WHERE column Like "_*"
and
INSERT INTO table SELECT * FROM TESTdata

Use Transaction is set to "No"

Nowhere in my code do I have
DoCmd.SetWarnings True

At the beginning of the app I have
DoCmd.SetWarnings False

Does anyone know how Warnings get turned on?
Thanks for any help.

Larry Mehl
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.562 / Virus Database: 354 - Release Date: 1/16/2004

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.562 / Virus Database: 354 - Release Date: 1/16/2004
Nov 12 '05 #3

P: n/a
"L Mehl" <me*********@cyvest.com> wrote:
Thanks. I don't think Tony will mind. You attributed the answer to him.


Not at all.

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
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.