Run reports w/ parameter from program

M

Mike P

I have about 20 different reports that have to be ran each day. The reports
require one input parameter from the use, Enter_Date. The Enter_Date
parameter is the same for all 20 reports.

Can I automate this process allowing the user to enter the Enter_Date once,
then programaticlly produce all the reports? A code snippet would be great
and Thank You! I am using Access 2007.
 
E

Evi

Instead of having the Input parameter in a query or report, you could have
an
unbound Form containing a text box (txtDate) and a command button. The user
types the date into the text box and presses the button.

Then you can use code attached to that button on the OnClick Event

Dim Crit as string
Dim MyDate as Long

MyDate = Format(Me.txtDate, "0")
'turns the date into a number
Crit = "[Enter_Date] =" & MyDate
'Filters report using Enter_Date

DoCmd.OpenReport "YourFirstReport", acPreview, , Crit
DoCmd.OpenReport "YourSecondReport", acPreview, , Crit
etc.


Evi
 
M

Mike P

This is a great start, but I think I am doing something wrong since the Enter
Parameter Value window still pops up asking for the Enter_Date value on each
report.

Also, can I have the 20 reports go directly to 20 PDFs as opposed to having
them all open up? The goal is to produce the 20 reports in PDF format saved
in a directory based on the single date that I enter in the unbound Form
containing the txtDate.

Thx for your help with this.

Evi said:
Instead of having the Input parameter in a query or report, you could have
an
unbound Form containing a text box (txtDate) and a command button. The user
types the date into the text box and presses the button.

Then you can use code attached to that button on the OnClick Event

Dim Crit as string
Dim MyDate as Long

MyDate = Format(Me.txtDate, "0")
'turns the date into a number
Crit = "[Enter_Date] =" & MyDate
'Filters report using Enter_Date

DoCmd.OpenReport "YourFirstReport", acPreview, , Crit
DoCmd.OpenReport "YourSecondReport", acPreview, , Crit
etc.


Evi






Mike P said:
I have about 20 different reports that have to be ran each day. The reports
require one input parameter from the use, Enter_Date. The Enter_Date
parameter is the same for all 20 reports.

Can I automate this process allowing the user to enter the Enter_Date once,
then programaticlly produce all the reports? A code snippet would be great
and Thank You! I am using Access 2007.
 
E

Evi

It sounds as if you have a Parameter Value either within the report (Perhaps
in its OnOpen Event) or in the query on which the report is based.

Don't know how to do the Export to PDF bit.

Evi


Mike P said:
This is a great start, but I think I am doing something wrong since the Enter
Parameter Value window still pops up asking for the Enter_Date value on each
report.

Also, can I have the 20 reports go directly to 20 PDFs as opposed to having
them all open up? The goal is to produce the 20 reports in PDF format saved
in a directory based on the single date that I enter in the unbound Form
containing the txtDate.

Thx for your help with this.

Evi said:
Instead of having the Input parameter in a query or report, you could have
an
unbound Form containing a text box (txtDate) and a command button. The user
types the date into the text box and presses the button.

Then you can use code attached to that button on the OnClick Event

Dim Crit as string
Dim MyDate as Long

MyDate = Format(Me.txtDate, "0")
'turns the date into a number
Crit = "[Enter_Date] =" & MyDate
'Filters report using Enter_Date

DoCmd.OpenReport "YourFirstReport", acPreview, , Crit
DoCmd.OpenReport "YourSecondReport", acPreview, , Crit
etc.


Evi






Mike P said:
I have about 20 different reports that have to be ran each day. The reports
require one input parameter from the use, Enter_Date. The Enter_Date
parameter is the same for all 20 reports.

Can I automate this process allowing the user to enter the Enter_Date once,
then programaticlly produce all the reports? A code snippet would be great
and Thank You! I am using Access 2007.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top