Solved

how do I automate the answering of "yes" to prompts that come about from running quereys?

Posted on 2004-04-10
7
203 Views
Last Modified: 2008-03-06
i have a macro that executes several different quereys in a particular order.  Some of those quereys prompt for a yes or no before updating data.  I always want to answer yes, is there a way to automate this so that the macro can be run and i don't have to sit there to answer "yes" ?
0
Comment
Question by:sixstringstu
  • 2
  • 2
7 Comments
 
LVL 11

Accepted Solution

by:
BillPowell earned 125 total points
ID: 10799740
Sure, a couple of ways.

Add the SetWarnings to OFF to your macro, and then when your finished, turn them back on.

In code this is easily done by simply using.

Currentdb.execute "queryname"

This does not generate warnings.

Hope this helps,

Bill
0
 
LVL 3

Expert Comment

by:RLGoldberg
ID: 10799813
The best way to run these queries is:

docmd.SetWarnings false               'This turns off all warnings and messages
docmd.OpenQuery "QueryName"     'This runs the query
docmd.OpenQuery "QueryName"     'This runs the query
docmd.SetWarnings true                'This turns on all warnings and messages

This is the code that you would place on the activating event.
0
 
LVL 11

Expert Comment

by:BillPowell
ID: 10799906
RLGoldberg has given another good way to do this, although Id stop short of saying the best way.  Currentdb.execute does not generate warnings so therefore no need to turn them on or off.  If you do decide to go the Docmd route then make sure you add some code that ensures your warnings get turned back on event in the event of an error, or else your warnings will remain off even after the procedure is finished.

Regards,

Bill
0
 
LVL 3

Expert Comment

by:RLGoldberg
ID: 10799921
Bill has a good point.  The reason that I feel that this approach is better is that on some queries I want the user to respond and therefore it is easier to work with a single method and just turn the warnings on and off.  Good catch Bill.
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 10808246
a quick way without having to change code is to go to Tools/Options, Edit/Find tab and uncheck the relevant boxes in the Confirm tab
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question