Multiple parameters for report

A

Annie808

I have a report based on a query asks for a beginning and ending parameter
(numbers that indicate regions for me). I would like to set this up in a
function/sql to run automatically, saving each report.
This is what I started:
SELECT [join Charter all and Indiv Query].Jadcode
FROM [join Charter all and Indiv Query]
WHERE ((([join Charter all and Indiv Query].Jadcode)=11005));

These Jadcodes run from 11000 to 99999, 541 in total.

Many thanks.
 
C

Clifford Bass

Hi Annie,

Your example has only one condition; not the two you originally
mentioned. So I will use that instead of the range that you mention. If you
really need a range, you will need to adapt as appropriate. Create your
query and report to report on all entries (no Jadcode condition). Then in
code (maybe off of a button) open up a record set that contains all of the
Jadcodes. Loop through that opening, exporting and closing the report for
each Jadcode. This is done by using the where clause in the DoCmd.OpenReport
command. Untested, you will need to modify as appropriate:

Dim rstCodes As New ADODB.Recordset

With rstCodes
.Open "select Jadcode from SomeTableOrQuery", _
CurrentProject.Connection, adOpenStatic, adLockReadOnly, adCmdText
Do While Not .EOF
DoCmd.OpenReport "rptTheReport", acViewPreview, , _
"Jadcode = " & !JadCode, acWindowNormal
DoCmd.OutputTo acOutputReport, "rptTheReport", acFormatSNP, _
"C:\Temp\TheReport_" & Format$(!JadCode, "00000") & ".snp"
DoCmd.Close acReport, "rptTheReport", acSaveNo
Loop
.Close
End With

Hope that helps,

Clifford Bass
 
J

John W. Vinson

I have a report based on a query asks for a beginning and ending parameter
(numbers that indicate regions for me). I would like to set this up in a
function/sql to run automatically, saving each report.

Umm... what do you mean by "saving each report"? Saving what? Where?

You say the query asks for a beginning and ending parameter but this query
doesn't:
This is what I started:
SELECT [join Charter all and Indiv Query].Jadcode
FROM [join Charter all and Indiv Query]
WHERE ((([join Charter all and Indiv Query].Jadcode)=11005));

These Jadcodes run from 11000 to 99999, 541 in total.

What is in fact the Query upon which the report is based?
 
A

Amos

soy mexicanos!!!
hablemos de cosas bonitas!
jaja

happy new year

Clifford Bass said:
Hi Annie,

Your example has only one condition; not the two you originally
mentioned. So I will use that instead of the range that you mention. If
you
really need a range, you will need to adapt as appropriate. Create your
query and report to report on all entries (no Jadcode condition). Then in
code (maybe off of a button) open up a record set that contains all of the
Jadcodes. Loop through that opening, exporting and closing the report for
each Jadcode. This is done by using the where clause in the
DoCmd.OpenReport
command. Untested, you will need to modify as appropriate:

Dim rstCodes As New ADODB.Recordset

With rstCodes
.Open "select Jadcode from SomeTableOrQuery", _
CurrentProject.Connection, adOpenStatic, adLockReadOnly,
adCmdText
Do While Not .EOF
DoCmd.OpenReport "rptTheReport", acViewPreview, , _
"Jadcode = " & !JadCode, acWindowNormal
DoCmd.OutputTo acOutputReport, "rptTheReport", acFormatSNP, _
"C:\Temp\TheReport_" & Format$(!JadCode, "00000") & ".snp"
DoCmd.Close acReport, "rptTheReport", acSaveNo
Loop
.Close
End With

Hope that helps,

Clifford Bass

Annie808 said:
I have a report based on a query asks for a beginning and ending
parameter
(numbers that indicate regions for me). I would like to set this up in a
function/sql to run automatically, saving each report.
This is what I started:
SELECT [join Charter all and Indiv Query].Jadcode
FROM [join Charter all and Indiv Query]
WHERE ((([join Charter all and Indiv Query].Jadcode)=11005));

These Jadcodes run from 11000 to 99999, 541 in total.

Many thanks.
 

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