|
Once again, I could not get the code to compile when I got around to testing it. ('src_hDC' would not compile as it remained undefined.)
I did a little looking around and found something that does appear to work for me though by using the OUTPUTTABLE method in place of the TRANSFERSPREADSHEET method. The last argument of the OUTPUTTABLE method actually allows you to open the document. (The -1 argument opens the document once it has been created. A value of 0 would leave the document created, but unopened.) To get this to work I created a temporary extract table to store the values prior to outputting them.
'Returns current system time in the system-defined long time format.
dtDateTime = Date
strDateTime = Format(dtDateTime, "MMM_d_yyyy")
strExportFileName = "Influenza_Pneumonia_Report_" & strDateTime & ".xls"
'Export report to MS Excel
With DoCmd
.SetWarnings False
.OpenQuery "qryDeleteInfluenzaPneumoniaExtract"
.OpenQuery "qryAppendInfluenzaPneumoniaExtract"
.SetWarnings True
.OutputTo acOutputTable, "tblInfluenzaPneumoniaExtract", acFormatXLS, strExportFileName, -1
.Beep
End With
Last edited by ctaylor; 09-26-2003 at 08:48 AM.
|