Back Forum Reply New

Running queries in the background

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

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 sucker back on)

Mike

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!!

Are the queries "select" or "make" or "append?"  Do you have a nested situation - where the result of one query feeds another?

They are "select" queries.

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?

No nests.

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.

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.

Thank you!
¥
Back Forum Reply New