?
Solved

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

Posted on 2004-04-10
7
Medium Priority
?
220 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
7 Comments
 
LVL 11

Accepted Solution

by:
BillPowell earned 500 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

801 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