Group:  Microsoft Access » microsoft.public.access
Thread: Multiple parameters for report

Geek News

Multiple parameters for report
Annie808 12/30/2008 5:38:04 PM
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.
RE: Multiple parameters for report
Clifford Bass 12/30/2008 6:28:01 PM
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" wrote:

[Quoted Text]
> 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.
Re: Multiple parameters for report
John W. Vinson <jvinson[ at ]STOP_SPAM.WysardOfInfo.com> 12/30/2008 8:00:08 PM
On Tue, 30 Dec 2008 09:38:04 -0800, Annie808
<Annie808[ at ]discussions.microsoft.com> wrote:

[Quoted Text]
>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?
--

John W. Vinson [MVP]
Re: Multiple parameters for report
"Amos" <Koma_325[ at ]hotmail.com> 1/1/2009 3:38:50 AM
soy mexicanos!!!
hablemos de cosas bonitas!
jaja

happy new year

"Clifford Bass" <CliffordBass[ at ]discussions.microsoft.com> escribió en el
mensaje de noticias:E1038830-7691-4B13-A3B8-90894EDD6979[ at ]microsoft.com...
[Quoted Text]
> 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" wrote:
>
>> 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.
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net