I am using the below code to transfer four queries to an excel file. Everything works just fine. My question is as follows: Each of the query's that I am using has as part of the critiera Where [TodaysDate] Between [Start Date] And [End Date]; When I use the command button to transfer the queries I have to input the Start date and the End Date 4 times. Is there another way to accomplish this. When the queries are used individually I need the Start Date and End Date critieria. When I transfer all 4 queries at the same time each query will always have the same Start Date and End Date. When I hit the command button to transfer all four queries I would like to only enter the Start Date and End Date 1 time. Any suggestions? and thanks.
Code:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "AllFaultsQry", "\\abmfl2sv\shared\Everyone\abajacks\BereaWUFaults\BereaWUFaults.xls", True, "All Faults"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "FaultsQry", "\\abmfl2sv\shared\Everyone\abajacks\BereaWUFaults\BereaWUFaults.xls", True, "Faults"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "SystemGroupTotalsMechanicalQry", "\\abmfl2sv\shared\Everyone\abajacks\BereaWUFaults\BereaWUFaults.xls", True, "Mechanical Faults"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "SystemGroupTotalsCosmeticQry", "\\abmfl2sv\shared\Everyone\abajacks\BereaWUFaults\BereaWUFaults.xls", True, "Cosmetic Faults"