Access Popup Windows - SetWarnings cmd

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have asked this before but didn't know where to put it or the correct
syntax from within the VB code

I have a couple of Make-table queries that when run state 'Microsoft Access
- The existing table will be deleted before you run the query - Do you want
to contiune Yes/No'

What I need to know is how to supress these so they automatically accept Yes

I was told of the SetWarnings command that if set to No should solve this
but....

The online help says you run it with to Docmd.

Does this mean from the vb code you put in something like Docmd.setwarnings
= No

????
 
DoCmd.SetWarnings False

to suppress the warnings and restore it after your code finishes with

DoCmd.SetWarnings True
 
Jai_Friday said:
I was told of the SetWarnings command that if set to No should solve this
but....

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
 
Thanks all ;)

Tony Toews said:
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
 
Back
Top