How do I get actions to only run one at a time?

K

Kelvin Beaton

I'm trying to do the following
Open a query that prompts the user for a date range.
Open a form to input a date range.
Export the query results to an Excel spreadsheet....

I can get all these to work, but need them to complete before the next setup
runs.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
DoCmd.OpenForm "frm_ReportDateRange", acNormal, "", "", acEdit, acNormal
DoCmd.OpenQuery "qry_ExportReportDate-ExportToExcel", acViewNormal,
acEdit
DoCmd.OutputTo acQuery, "qry_ExportReportDate-ExportToExcel",
"MicrosoftExcelBiff8(*.xls)", "", True, "", 0
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I'd also rather that the query not show, but run in the background.

Anyone know how to do this, or has an example db that does this?

Thanks

Kelvin
 
S

storrboy

If the form is supposed to supply criteria for the query, then open it
acDialog. When the user clicks ok or continue or whatever, hide the
form (Visible=False). You don't need to open the query when using
OutPutTo. If it gets it's info from the form, have the query reference
it and when OutPutTo runs, the export happens without seeing the
datasheet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top