make a form, with a list box, the list shows all the unique recs of Field A
A
B
C
D
the query to send, qsMyRpt, will look at what is selected in the list ,
select * from table where [fieldA]=forms!myForm!lstBox
a button to run the code to scan the list and export,
Code:
sub btnMake_click()
dim i as integer
dim sUnit as string
dim vFile
for i = 0 to lstBox.listcount - 1
sUnit = lstBox.ItemData(i) 'get next item in list
lstBox = sUnit 'set list to that item for the query to read
vFile = "c:\temp\" & sUnit & ".xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "qsMyRpt", vFile, True, sUnit
next
end sub