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

  • Thread starter Thread starter Kelvin Beaton
  • Start date Start date
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
 
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.
 
Back
Top