Getting rid of "You are about to append..." in DoCmd.RunSQL

  • Thread starter Thread starter Adam Steiner
  • Start date Start date
A

Adam Steiner

Hi,

Using A2K3, when using DoCmd.RunSQL, is there a way for me to disable
the 'You are about to append 1 records...'

I'll be using this a lot, at times it will be used to append hundreds of
rows, and I'd prefer to not need to hit enter every time.

Thanks,

Adam
 
In
Adam Steiner typed:
Hi,

Using A2K3, when using DoCmd.RunSQL, is there a way for me
to disable
the 'You are about to append 1 records...'

I'll be using this a lot, at times it will be used to
append hundreds
of rows, and I'd prefer to not need to hit enter every
time.

Thanks,

Adam

DoCmd.SetWarnings False should do what you want. It is both
good practice and sensible to turn the warnings back on
after running the SQL - DoCmd.SetWarnings True.

--
Nick Coe (UK)
AccHelp v1.01 Access Application Help File Builder
http://www.alphacos.co.uk/
Download Free Demo Copy
----
 
Nick said:
In
Adam Steiner typed:



DoCmd.SetWarnings False should do what you want. It is both
good practice and sensible to turn the warnings back on
after running the SQL - DoCmd.SetWarnings True.


Thanks Nick. Worked like a charm
--Adam
 
Adam Steiner said:
Using A2K3, when using DoCmd.RunSQL, is there a way for me to disable
the 'You are about to append 1 records...'

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