How to programmatically uncheck confirm record changes?

G

Guest

Is there a way that I can add code to the OnOpen or OnLoad events of the
Switchboard form so that it automatically unchecks the user option to confirm
record changes? I would rather do it this way than to visit every user's
station, and I haven't found anything similar posted here or in the
application help.

Thanks in advance!
 
G

Guest

Hi,
your users shouldn't really receive any confirmation messages unless they
delete records or paste multiple records from the clipboard into the form.
If they are doing either of these things then you should probably rethink
what you created for them. Users shouldn't really be able to delete records,
but rather maybe mark them inactive. This way the data will be available
later on if needed for whatever purpose.
HTH
Good luck
 
G

Guest

Hi, Ben.
Is there a way that I can add code to the OnOpen or OnLoad events of the
Switchboard form so that it automatically unchecks the user option to confirm
record changes?

An application that changes a user's preferences and doesn't change them
back every single time is considered a misbehaving application. You'd have
to ensure that the user's original settings are put back, because this
setting affects all Access databases, not just the current one.

A better alternative is to avoid having those pesky messages show up in the
first place. When running an action query, use the CurrentDb().Execute
method in a VBA procedure. For example (watch out for word wrap):

CurrentDb().Execute "DELETE * FROM MyTable WHERE CreationDate =
Date();", dbFailOnError

.. . . which will silently remove the records in this table that were created
today, and never bother the user unless the table is missing or locked by
another process.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info
 
T

Tony Toews

BenL712 said:
Is there a way that I can add code to the OnOpen or OnLoad events of the
Switchboard form so that it automatically unchecks the user option to confirm
record changes? I would rather do it this way than to visit every user's
station, and I haven't found anything similar posted here or in the
application help.

There is a programmatic way of setting the options using database
properties, I think. However this is a bad idea as other useful
warning messages will then not appear.

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
 

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