Confirm Action Queries: False

  • Thread starter Thread starter George
  • Start date Start date
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
 
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)
 
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)





.
 
Back
Top