I currently have to run a report for each facility in our company and for each time running the report it prompts a date range and the 2 or 3 digit facility code. I then have to export them as a pdf and rename and save them. I am curious as to if its possible to code a macro to where I could input the date range once and have it step through all 140 ish facilities and run the report for each of them and save them in a folder while naming them using their corresponding facility code. I can make a new table lining up each facility with its code for the macro to reference if needed for the naming part. Mainly asking to see if its possible and worth investing time into as I have minimal knowledge of VBA code in general (especially in regards to access) and have only lightly used it in excel. {While looking through the possible duplicates I did see one or 2 questions that were close but an answer specific to this would still be helpful as one mentioned SSRS and/or running reports from a server and that doesnt seem to apply}
So far all I have tried was to build a macro using the create tab. I selected the openreport command and filled out the parameters as well as the ExportWithFormatting command and then tried to use the redo command to loop it. The OpenReport command ran the report successfully and prompted me to enter the date range and the facility code (I can enter a range of all the facility codes but only ran it from 10-15) but when running it ended up just generating page after page until I stopped it at page 318. Usually the report is 7 pages long max so i thought it would stop around page 35.
CHiLLeD is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.