Topics Search

Macro to run reports based on query criteria

Macro to run reports based on query criteria
Views: 37
so be nice
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
Sponsored Links:

Similar posts...

 

Criteria for Report/Query being ignored

Criteria for Report/Query being ignored Icon
I have a report with a record source based on a query that has certain criteria that must be met in a particular field. However, this criteria is being ignored in 4 of the 5 reports. These five reports are similar except that they are dividing all the records up into the five separate reports based on this one field. The only one that is working, is the one whom's data is showing up on the other four reports.

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
 

Setting up Macro on Criteria filtered Querry

Setting up Macro on Criteria filtered Querry Icon
I have a query that includes a Date/Time field. Currently each time we need to run it we have to change the criteria; for example - Like "*03/05/2012*" to Like "*03/05/2012*", to get query only the data for today.

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.
 

access 2007 macro

access 2007 macro Icon
I have built 12 queries that obtain data from the same 2 tables but for 12 different reports. I have created 12 separate reports as well. I want to run all 12 queries/reports at once. I have set up a filter in which I enter 'from' and 'to' dates, but I have to do this for each query/report. I want to build a macro that will run all 12 reports at once, and all I'll have to do is manually enter the dates one time at the beginning of the macro. I can not get the date filter at the beginning of the macro to operate successfully - keep getting error message. Where can I get good resource data that will help me with this macro? The Microsoft online help doesn't cut it
 

Macro Creation

Macro Creation Icon
I have my report built and is tied to a query. Some background on this: I need to send out approval reports to supervisors for telecom bills. The query is built so that no criteria is specified in the Approver field.

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
 

Automating multiple reports with a macro that prompts user for a date range

Automating multiple reports with a macro that prompts user for a date range Icon
A database that I created has a main query that includes a lot of calculations of data that it pulls from a main table. The main query prompts the user for a date range with a "Between [start date] And [end date]" request in the Criteria for the "Date" field.

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?
 

Query Criteria based on drop down menu

Query Criteria based on drop down menu Icon
On my query I added criteria that says [Forms]![frmMain]![Combo11] so that the query will run based on what is selected from the drop down. However, if the drop down is left blank (no select made). How would I update my criteria to say than display all?
 

Variable Not passing to query

Variable Not passing to query Icon
I have a command button which when clicked, runs a VBA macro which saves a report to a PDF for the current record. The report is based on a predefined filter for based on the current ID field on the original form.

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?
 

Can I manipulate a query for a few different reports?

Can I manipulate a query for a few different reports? Icon
I have a query that I would like to base several reports off of. Can I add parameters to the reports so I won't have to have the same query done several times just to change the parameters of what I am looking for?

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.
 

Is Grouping or Criteria Applied first?

Is Grouping or Criteria Applied first? Icon
In an Access Query, which is applied first: Grouping or Criteria?

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
 

When a query result is empty

When a query result is empty Icon
So I would like to pose it here. I have a simple query that returns data based on entering a specific criteria.

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.?
 
Sponsored Links: