views:

142

answers:

3

Hi to all, in Microsoft Access, is there a way which I can programatically set the Confirm Action Queries flag on the options screen to False? Ideally when the database is started up I would like to check if it's true, and if so, mark it as false for the currently logged in user.

The application is locked down reasonably tightly, so ideally, we don't want to have to give users acces to the action menu.

Thanks in advance.

PG

+1  A: 

Place the following in a method when the database starts:

If Application.GetOption("Confirm Action Queries") Then
    Application.SetOption "Confirm Action Queries", False
End If
Harry Steinhilber
Thanks Harry.. simple as that :-)
Paul Green
I don't think that's ever a good idea. Better to run your action queries with CurrentDB.Execute "MyActionQuery", dbFailOnError.
David-W-Fenton
A: 

It is usually better to either use Execute or Set Warnings to get rid of the warning on action queries because options apply to all databases. If you change the options in code, I recommend that you set them back before exiting (and hope that exits are not unexpected) or someone might get an unpleasant surprise when the expected prompt does not appear in their application.

Remou
A: 

I am assuming that you want to turn this option off becuase you are running queries from code. You can turn off all query prompts by using the macro action SetWarnings. Available from VBA as a method of the DoCmd object. Remember to turn it back on again after your code has completed. You can also avoid the warning by using the Execute method in either ADO or DAO.

pipTheGeek