Determining whether a query is open

  • Thread starter Thread starter Dale Fye
  • Start date Start date
D

Dale Fye

How can I determine, via code, whether a query is open? I
know how to do this for forms and reports, but have not
figured out how to do it for queries.

Thanks
 
That is easy for you to say, but I have an client that wants to be able to
enter some parameters on a screen, by selecting from combo and list boxes,
and generate several different reports based on these parameters. Several
of these reports are based on cross tab queryies, which I have not had the
time to code the reports for.

I want to build the query string, populate the querydef.sql, then open the
query for the user to review and/or print. However, since I cannot do this
in "dialog" mode, I want to put some code imediately following the
docmd.openquery, that does a continuous loop while, while query is open.
Then, when the query is closed, the code will continue.

I will eventually get to the point where I have written codeto
programatically build the report, but I have higher priorities right now.
 
I have a report form. The user selects which reports he/she wants to run
from a listbox, then hits the Execute command button. The code loops
through the selected reports and either opens the report in preview or
prints the report, depending on what the user has selected.

Depending on what options the user has selected for these reports (the
queries I have yet to turn into reports), they might fit in portrait mode,
but more likely need to be printed in landscape. For that, I need to open
the query, allow the user to select which mode they want, and print the
results of the query. When they close the query, I want my code to resume
looping. For the actual reports, I have a IsReportLoaded() function which
lets me know if the Report is still on screen. I continue to loop while
IsReportLoaded is True (with a doevents and a test to see whether the cancel
button has been clicked nested in the loop). Once the form is closed, the
outer loop continues with the next report. I need a similiar function to
check and see whether a particular query is open.
 
Back
Top