I have a service database that when a button is pressed I would like multiple excel spreadsheets to auto-generate to a defined location based on 2 feild values in 2 separate tables
Requirements:
1. the first value will be territory ID and I would like every unique value in this field to produce and new excel file
2. the second value Instrument Type is a lookup feild on a separate table and i would like each unique value to be a separate tab in each of the workbooks that was previously produced
here is an example SQL statement for one tab on one workbook:
Code:
SELECT Instruments.Institution, Instruments.Territory, Instruments.LastName, Instruments.FirstName, Instruments.SerialNum, Instruments.PurchaseDate, Instruments.WarrantyPeriodStart, Instruments.WarrantyPeriodEnd, Instruments.WarrantyQuoted, Instruments.AnnualPM, Instruments.AnnualPMStatus, Instruments.[6MonthPMMonth], Instruments.[6MonthPMStatus], Instruments.[2013Service], Instruments.[2012Service], Instruments.[2011Service], Instruments.[2010Service], Instruments.[2009Service], Instruments.Notes, Instruments.City, Instruments.State, Instruments.Zip, Instruments.Instruments, Instruments.WarrantyType, IntrumentTypes.Instruments
FROM IntrumentTypes INNER JOIN Instruments ON IntrumentTypes.ID = Instruments.Instruments
WHERE (((Instruments.Territory)=103) AND ((IntrumentTypes.Instruments)="autoMACSClassic"));
Here is how i have previously generated the reports before many more territories were added and automation became a necessity
Code:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, _
"qryautoMACSclassic", strPath, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, _
"qryautoMACSpro", strPath, True
End If
I did find this but do not know how relevant to my situation it is http://www.accessmvp.com/KDSnell/EXC...ExportSepFiles
any help would be greatly appreciated