getting rid of warning dialog

E

ernie.bornheimer

Hello

I'm not really a developer, but I'm doing some work in an Access 2003
database. I got my code to work (it writes data from a form to a table), but
there is an annoying warning dialog that pops up, and I'd like to get rid of
it if possible. It says:

You are about to append 1 row(s).Once you click Yes, you can't use the Undo
command to reverse the changes. Are you sure you want to append the selected
rows?

How can I get rid of this? It'll just be annoying to my users.

Thank you!

Ernie Bornheimer
 
M

missinglinq via AccessMonster.com

DoCmd.SetWarnings False
'Your code for appending record goes here
DoCmd.SetWarnings True

Be absolutely sure to have the

DoCmd.SetWarnings True

statement or you might miss some important error messages later on!
 
C

Cheese_whiz

Hi Ernie:

Try tools>options>Edit/Find and under 'Confirm' uncheck action queries.
Of course, that turns off the warnings for ALL action queries..not just the
one you're dealing with here.

CW
 
T

Tony Toews [MVP]

Cheese_whiz said:
Try tools>options>Edit/Find and under 'Confirm' uncheck action queries.
Of course, that turns off the warnings for ALL action queries..not just the
one you're dealing with here.

Definitely not recommended for that exact reason you state.

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
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
T

Tony Toews [MVP]

ernie.bornheimer said:
You are about to append 1 row(s).Once you click Yes, you can't use the Undo
command to reverse the changes. Are you sure you want to append the selected
rows?

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
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 

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