Pass a set of known parameters to query then export

texasgrandma

New member
Local time
Today, 15:04
Joined
Apr 14, 2008
Messages
9
Table: DailyExport
Field: FailureGrouping (actually is offices)

I want to export all the fields from DailyExport each of our 9 offices to Excel, whetjer or not they have date in the DailyExport table. So if not, the exported workbook would only have columns headings.

I need help to loop through the nine offices and export each office report to Excel.



Dim StrQry As String
Dim strfullpath As String
Dim SOffice as String

strSQL = "SELECT * FROM DailyExport WHERE FailureGrouping = " & SOffice



strfullpath = "Y:\" & SOffice &" "& Format(Date,"mm-dd-yy") & "_Failures.xlsx"
DoCmd.TransferSpreadsheet acExport, , FailureGrouping, strfullpath, False
 

Users who are viewing this thread

Back
Top Bottom