I haven't had a lot of exposure to Access and VBA for around ten years, so I'm practically a newbie. I remember a little bit of VBA, and I know some powershell and vbscript. I apologize in advance for my ignorance and stumbling.
I need to print a series of weekly reports for different departments. I don't want to maintain a different report for each department, so I'd like to be able to change the report header and query source for one report using VBA.
Here's how I was thinking of doing it:
If there's a better way to do this, I'm open to that too.
Thank you!
I need to print a series of weekly reports for different departments. I don't want to maintain a different report for each department, so I'd like to be able to change the report header and query source for one report using VBA.
Here's how I was thinking of doing it:
- Get the name of the first department from a table.
- Get the appropriate query name from the department name. They are all named "qryDepartment".
- Open the report (rptWeekly) in design mode.
- Change the report record source to qryDepartment.
- Change the report header (Label26) to "Department Weekly Report".
- Export the report to PDF.
- Go back to #1 for the next dept.
If there's a better way to do this, I'm open to that too.
Thank you!