We help IT Professionals succeed at work.

Turning off query prompts on runtime version of Access 2016

Andy Brown
Andy Brown asked
on
121 Views
Last Modified: 2017-04-19
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?
Comment
Watch Question

Remote Training and Programming
CERTIFIED EXPERT
Top Expert 2015
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
Andy BrownDeveloper

Author

Commented:
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 FyeOwner, Dev-Soln LLC
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2010

Commented:
no points please.

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

Open in new window

or:
docmd.OpenQuery

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, AccessRemote Training and Programming
CERTIFIED EXPERT
Top Expert 2015

Commented:
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.
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
CERTIFIED EXPERT
Top Expert 2007

Commented:
+1

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions