G
Guest
I have a two part question. I am exporting a query to an Excel spreadsheet
every week with each tab containing query results with one criteria changed.
I have 24 different results for different areas. I originally set up
multiple queries in Access, each with the one changed criteria, and then
exported them using the DoCmd.TransferSpreadsheet.
'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
"qry_CTA_Cincinnati", "D:\ CTA Details.xls", , "Cincinnati"
This was wonderful until we started modifying the base query which meant I
had to go back and change each individual query.
My question is how to write a loop in VBA that will take the original query,
add the criteria, export it to Excel, then take the next criteria and do the
same thing till it is done. That way if there are changes to the original
query I will only have to change it once.
every week with each tab containing query results with one criteria changed.
I have 24 different results for different areas. I originally set up
multiple queries in Access, each with the one changed criteria, and then
exported them using the DoCmd.TransferSpreadsheet.
'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
"qry_CTA_Cincinnati", "D:\ CTA Details.xls", , "Cincinnati"
This was wonderful until we started modifying the base query which meant I
had to go back and change each individual query.
My question is how to write a loop in VBA that will take the original query,
add the criteria, export it to Excel, then take the next criteria and do the
same thing till it is done. That way if there are changes to the original
query I will only have to change it once.