Avatar of Andy Brown
Andy Brown
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Turning off query prompts on runtime version of Access 2016

Hi - For some reason, I cannot seem to switch off prompts to run existing Update/Delete queries (either stored queries or queries created on the fly).  I used to use something like this - but it no longer seems to work.

Application.SetOption "Confirm Action Queries", 0
Application.SetOption "Confirm Document Deletions", 0
Application.SetOption "Confirm Record Changes", 0

Any ideas?
Microsoft AccessVBA

Avatar of undefined
Last Comment
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

8/22/2022 - Mon
crystal (strive4peace) - Microsoft MVP, Access

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Andy Brown

Thanks Crystal - I'm seeing a lot of suggestions to go that way (so I'm going to take a look at the code now).

Just out of curiosity - Do you know if they stopped providing those setup options, as I can't seem them anywhere now?

Anyhow, thanks again - very much appreciated.
Dale Fye

no points please.

Strongly agree with Crystal, better to use the Execute method than either:

Open in new window


Open in new window

Personally, I like to add the dbFailOnError as an option so that I can record any errors that might occur and process them properly.
db.Execute "YourQueryName", dbFailOnError

Open in new window

But when you do this, you must have an error handler (you should anyway) to deal with any errors.
crystal (strive4peace) - Microsoft MVP, Access

you're welcome, Andy

not being able to change the setup options may have something to do with permissions and where files are located. I have not done testing to know what might have changed.

dbFailOnError -- Dale brought this up and it needs consideration -- this is something that needs to be evaluated on a case-by-case basis.  For example, most of the append queries I run only add new records due to unique indexes not allowing duplicates to go in -- in those cases, I do want the rest of the records that are ok to go in, so I would not want the SQL to fail because some of the records didn't make it. (The Append query might be followed by an Update query to change the records that were already there).  To tell me if  the SQL itself has an error, I have code to run SQL statements that also returns how many records were changed.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)