Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create a macro to print multiple reports

Status
Not open for further replies.

rjnitke

Technical User
Sep 5, 2003
11
0
0
US
Hi. I have created a macro in my database to print multiple End-of-Month reports all at once. My question is; How do I get the macro to print all the reports for a month without my having to enter the inclusive dates for each report? I just want to be able to enter the dates in once and let the macro do the rest. Any ideas?
 
Hi!

Create some textboxes or whatever on the form you use to call the macro. In those textboxex you type the dates you need. Name the textboxec for instance "txtStartDate" and "txtEndDate"

Then just refer to the textboxes in the queries:

In stead of [Enter start date] in the criteria field, use:

forms!FormName!txtStartDate

Hope this is what you're asking for, Roy-Vidar


 
Hmmmm. I'm not sure I follow. I don't use a form to call the macro....the macro itself is more of a push-button deal for my db. I want to just run the macro and have it know that the dates for all the reports it's set to print are the same. Is this possible?
 
Do you then start the macro by double-clicking it, does it start automaticly triggered by another event, or...?

Now, the dates have to be stored somewhere, and I just assumed you had a button on a form to call the macro. If you do have a form with a button, my previous solution shoul work.

Else, you could use some global variables in VBA, but then you would have to write functions to get the values to your queries.

With a bit more information, I could probably give better advice:) Roy-Vidar
 
As it is now....I just rclick the macro and select run. The dates come from the criteria in each of the queries that fill each of the forms being set to: between [From Date] and [Through Date]. I understand that my macro is opening up the forms and they are running just as I have desitned them to run. I am just trying to make life easier for anyone running the EOM reports so the date range is only entered once.
 
OK - I would suggest my first solution.

I'm now going thru it with a bit details.

Create a form with two textboxes (create in design view)

Name them txtFromDate and txtThroughDate How:

after you've added the textboxes, rightclick the them, select properties, go to the "other" tab and insert the name.

In each of the queries, replace the [Type Start Date] with forms!theFormName!txtStartDate and [Type Trough Date] with forms!theFormName!txtThroughDate.

After this, add a button on the form (use the wizard). Select Miscellaneous and Run Macro. In the next step, chose your macro.

Why:
If you "keep" the start and through time in your form, and reference them in all your queries, you do not have to type them for every report.

I think this should save some time, Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top