Startup Options

B

Bill M

I am trying to startup an access application and turn off the Options of
confirm deletion and additions (when using an append query) without having
the user turn these options off themselves. Is there a way to do this?
 
X

xRoachx

Hey Bill, try:

DoCmd. SetWarnings False

To turn the warnings off and:

DoCmd.SetWarnings True

To turn them back on. Be sure to turn the warnings back before exiting your
function.
 
J

Jörg Ackermann

Hi,

Bill said:
I am trying to startup an access application and turn off the Options
of confirm deletion and additions (when using an append query)
without having the user turn these options off themselves. Is there
a way to do this?

With Application
.SetOption "Confirm Record Changes", False
.SetOption "Confirm Action Queries", False
End With

for other options see:
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q216888

Joerg
 
F

Fred Boer

Dear Bill:

You can do so in code, but you should take care. Changes to these settings
will affect all users of the application. So, the next user of the computer,
who expects a warning to come up, might be quite annoyed not to see one! You
should be sure to reset any of these settings when the application ends.

You can set this in code, using the Application.SetOption method. For
example, in OnOpen event of the first form of your application, you could
have the following:
Application.SetOption "Confirm record changes", False
Application.SetOption "Confirm action queries", False

You can set all kinds of options this way; there is a table in VBA
help.(Index: SetOptions; Topic "Set options from Visual Basic")

HTH

Fred Boer
 
B

Bill M

Thank you that did exactly what I wanted.

xRoachx said:
Hey Bill, try:

DoCmd. SetWarnings False

To turn the warnings off and:

DoCmd.SetWarnings True

To turn them back on. Be sure to turn the warnings back before exiting your
function.
 
D

Douglas J Steele

Better, in my opinion, than globally turning off those messages is to turn
them off only when appropriate (by using DoCmd.SetWarnings False before
running the query, and DoCmd.SetWarnings True afterwards), or by using the
Execute method of the database or query to prevent them from being issued in
the first place.

I prefer the Execute method, since it also allows you to trap for errors,
should something go wrong during the append.

If you're using a SQL string, you can use the Database Execute method:

CurrentDb().Execute "INSERT INTO ...", dbFailOnError

If the query's been saved, you can use the QueryDef Execute method:

CurrentDb().QueryDefs("MySavedQuery").Execute dbFailOnError

Note that these are DAO methods. If you're using Access 2000 or 2002, you'll
need to make sure that you've added a reference to the DAO library, since
neither of those versions of Access included that library by default.
 
Top