Running queries in the background

RBoshears

New Member
Joined
Oct 28, 2003
Messages
21
I have set up a form to run a set of queries as an event after the user chooses an input. However, the queries open on the screen. What is the syntax to have them run without physically showing up onscreen?

Thanks
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Do you mean you're getting prompts for action queries?
If yes, then just head over to Tools->Options->Edit/Find and turn off the checkboxes for Record Changes/deletions/action queries.

I don't remember the property name to toggle via VBA but you can do it there. Following two lines turn off/on screen refresh. Think I just learned these two myself last week courtesy of bat17.

DoCmd.Echo False (turns off screen refresh)
DoCmd.Echo True (turns that ****** back on)

Mike
 
Upvote 0
Thanks forthe code, that may help down the road. Right now I'm not getting prompts, but the results of the query is being displayed. I want to use the results of the query elswhere in the form, so I don't actually want to "see" the query results. I'm currently using the DoCmd.OpenQuery. I'm looking for the correct syntax to run it without seeing it. Thanks!!
 
Upvote 0
Are the queries "select" or "make" or "append?" Do you have a nested situation - where the result of one query feeds another?
 
Upvote 0
Well AFAIK there are only 2 roles for select queries: to feed another query (or feed something external), or show on the screen. Is that the case for you?
 
Upvote 0
What I'm trying to do is use a query to drill down to some information, and then connect it to a option group that will allow me change a field from the query.
 
Upvote 0
OK I just looked more closely - my bad. If the other part of the form has a query as its source, then set the recordsource for that form object as the query. If you want to do this in code, just do something like this for a listbox.
activeform.lbWidgets.recordsource = "Query1" '.controlsource?
DoCmd Requery lbWidgets.name

This is untested, so "all," please scrutinize heavily and voice corrections.
 
Upvote 0

Forum statistics

Threads
1,221,573
Messages
6,160,593
Members
451,657
Latest member
Ang24

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top