Confirm Action Queries: False

G

George

Is it possible to programatically uncheck the Confirm
Action queries on the Options dialog?

I've tried to Set Warnings False, but that gets rid of
warnings I sometimes want to see.

I like the idea of storing a users initial setting, and
then restoring that setting after my application ends.
(I don't want to impose my Access preferences on users who
may have their own preferences)

Thanks
George
 
D

Douglas J. Steele

You can issue DoCmd.SetWarnings False before you run the action query (and
then remember to use DoCmd.SetWarnings True afterwards):

DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True

However, I find it better to use the Execute method of the Database (or
QueryDef object, if you've saved the SQL), since not only does that not
generate a Confirm Action pop-up, but it also allows you to trap any errors
that might have occurred:

CurrentDb().Execute strSQL, dbFailOnError

or

Dim qdfCurr As QueryDef

Set qdfCurr = CurrentDb().QueryDefs("MySavedActionQuery")
qdfCurr.Execute dbFailOnError

Note that this requires that you have a reference set to DAO (by default,
Access 2000 and 2002 do not have the reference set)
 
G

George

Thanks.
I'll try that
-----Original Message-----
You can issue DoCmd.SetWarnings False before you run the action query (and
then remember to use DoCmd.SetWarnings True afterwards):

DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True

However, I find it better to use the Execute method of the Database (or
QueryDef object, if you've saved the SQL), since not only does that not
generate a Confirm Action pop-up, but it also allows you to trap any errors
that might have occurred:

CurrentDb().Execute strSQL, dbFailOnError

or

Dim qdfCurr As QueryDef

Set qdfCurr = CurrentDb().QueryDefs ("MySavedActionQuery")
qdfCurr.Execute dbFailOnError

Note that this requires that you have a reference set to DAO (by default,
Access 2000 and 2002 do not have the reference set)

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)





.
 

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