This is the 3rd thread on this topic by this poster.
Options:
1. multiple queries or maybe one query with dynamic parameters but not sure those would work with the export wizard
2. Excel automation as recommend in the first thread https://www.accessforums.net/access/...ets-53923.html
3. export filtered report
Code:
Private Sub Command0_click()
Dim strPathFile As String
'Set recordset from Ledger
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT DISTINCT Ledger FROM Ledger_No")
'Start looping through all ledgers
While Not rs.EOF
strPathFile = "\\buzz2\Office on Buzz2\Newonlineusers\" & rs!Ledger & "New Online Users" & ".xlsx"
DoCmd.OpenReport "LedgerExport", acViewPreview, , "Ledger=" & rs!Ledger
DoCmd.OutputTo acOutputReport, , acFormatXLSX, strPathFile
DoCmd.Close acReport, "LedgerExport", acSaveNo
rs.MoveNext
Wend
End Sub
4. VBA code that modifies query object with QueryDefs
The other thread https://www.accessforums.net/access/...ode-54031.html