Macro to run reports based on query criteria
I've got a bit of a macro problem, I'm looking to create a macro which will input criteria, by which reports can be created. I have a report based on a query which asks for the department code, to return all the access data for the department.
I want to create a macro which will create and print a report for each of the departments, by automatically entering the department codes.
Any ideas? Any more detail needed
Thank you for taking the time to report an issue.
What's wrong... Please write below.
Do I need to show more, or can anyone tell what is going on here? All five reports have their own separate record source.
I have a feeling I might have to explain more
I have not seen a way to use the Like function and the Date() in the same criteria. Normally not an issue to change it, but it has became evident that we need to run this query very late in the evening, and I need a macro to set the Windows schedule to run it. So need a way to either get the query to only pull today's date, or a macro to change the criteria when it auto launches as scheduled.
A bit of a noob to access, and working with a database that someone else built.
I want to build a macro that will process all approvers, one at a time, and generate reports to the snapshot viewer.
I am pretty new to access and I am not familiar with VB or XML coding. I have the macro built for the first record, but I don't know how to "do until end" type scenario.
Can this be done using the macro actions and not writing code? I am on Access
I have also created many secondary queries that get their data from the calculated fields in the main query.
Finally, I have created about a dozen individual reports that are based upon each of these secondary queries.
I have automated the process of running these reports with a macro that executes the "OutputTo" action a dozen times to save each report as an individual Rich Text file. Theproblem I have is that, when I run the macro, it asks me for the [start date] and [end date] a dozen separate times.
Is it possible to modify the macro to prompt the user one time for the start and end dates and then to pass those dates on to each individual report/query? Or do I need to try to do this with a VBA module?
I have tried setting the criteria field to the current record of the form, setting a variable to the ID field. But the query is not getting the information to compare and the output of thereport is #Type and #Error.
When the macro is run, the query runs and prompts for the information the criteria is looking for.
How do I pass a variable from a form to a query in VBA?
For example, my database has several different craft codes and ideally what I would like to happen is to be able to use that same query to change the craft codes each time, or skill set. As of right now, I have the same query run with different criteria for each query.
It is the same idea for several reports that I will be running for my executives.
I am trying to run a query whose results could potentially differ depending on whether the query's data set is grouped, then filtered based on criteria or filtered based on criteria, then grouped.
(i've done a little testing and it looks like criteria is applied first but I wanted to be sure
The query is run from a macro and the results get created in a spreadsheet and emailed to certain people. The problem I have is that if the query returns no data, for whatever reason, then I don't wish the spreadsheet to be created or emailed.
So, in basic terms, if I enter criteria that is spelt incorrectly or the data doesn't exist, I want the query to error and tell me why. Is this something easy to achieve.?