Home All Groups Group Topic Archive Search About

Report - how to print each page to new document.

Author
3 Jul 2009 4:50 PM
GA
Hello all,

I've been trying to get my head round how to do this and completely
failed.

I've got a report which I can print off without any problems to a pdf
but obviously I get a single pdf with several hundred pages (each
record prints to a new page) but what I want is to print mulitple
documents from one report and hopefully automatically name each one
using the one of the fields from the report.

Can someone point me in the right direction please.

Thanks,
GA

Author
3 Jul 2009 5:01 PM
GA
I don't know if it's relevant but what I intend is to use the process
described on Dev Ashish' site -
http://www.mvps.org/access/reports/rpt0011.htm to output directly to
pdf's.


On Fri, 03 Jul 2009 17:50:40 +0100, GA <talk2me@here.please> wrote:

Show quoteHide quote
>Hello all,
>
>I've been trying to get my head round how to do this and completely
>failed.
>
>I've got a report which I can print off without any problems to a pdf
>but obviously I get a single pdf with several hundred pages (each
>record prints to a new page) but what I want is to print mulitple
>documents from one report and hopefully automatically name each one
>using the one of the fields from the report.
>
>Can someone point me in the right direction please.
>
>Thanks,
>GA
Are all your drivers up to date? click for free checkup

Author
4 Jul 2009 2:24 AM
Tony Toews [MVP]
GA <talk2me@here.please> wrote:


>I've got a report which I can print off without any problems to a pdf
>but obviously I get a single pdf with several hundred pages (each
>record prints to a new page) but what I want is to print mulitple
>documents from one report and hopefully automatically name each one
>using the one of the fields from the report.

For a page on how to print a report for a single record and how to
generate reports to attach to emails see the Emailing reports as
attachments from Microsoft Access page at
http://www.granite.ab.ca/access/email/reportsasattachments.htm

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Granite Fleet Manager http://www.granitefleet.com/
Author
4 Jul 2009 9:24 AM
GA
On Fri, 03 Jul 2009 20:24:07 -0600, "Tony Toews [MVP]"
<tto***@telusplanet.net> wrote:

Show quoteHide quote
>
>GA <talk2me@here.please> wrote:
>
>
>>I've got a report which I can print off without any problems to a pdf
>>but obviously I get a single pdf with several hundred pages (each
>>record prints to a new page) but what I want is to print mulitple
>>documents from one report and hopefully automatically name each one
>>using the one of the fields from the report.
>
>For a page on how to print a report for a single record and how to
>generate reports to attach to emails see the Emailing reports as
>attachments from Microsoft Access page at
>http://www.granite.ab.ca/access/email/reportsasattachments.htm
>
>Tony

Thanks for that. I am fine printing a report for a single record but I
don't want to do it manually several hundred times.

I am trying to run the report unfiltered but have it print each record
to a new document i.e. not print a document for one record.

GA
Author
4 Jul 2009 10:03 AM
GA
On Sat, 04 Jul 2009 10:24:08 +0100, GA <talk2me@here.please> wrote:

Show quoteHide quote
>On Fri, 03 Jul 2009 20:24:07 -0600, "Tony Toews [MVP]"
><tto***@telusplanet.net> wrote:
>
>>
>>GA <talk2me@here.please> wrote:
>>
>>
>>>I've got a report which I can print off without any problems to a pdf
>>>but obviously I get a single pdf with several hundred pages (each
>>>record prints to a new page) but what I want is to print mulitple
>>>documents from one report and hopefully automatically name each one
>>>using the one of the fields from the report.
>>
>>For a page on how to print a report for a single record and how to
>>generate reports to attach to emails see the Emailing reports as
>>attachments from Microsoft Access page at
>>http://www.granite.ab.ca/access/email/reportsasattachments.htm
>>
>>Tony
>
>Thanks for that. I am fine printing a report for a single record but I
>don't want to do it manually several hundred times.
>
>I am trying to run the report unfiltered but have it print each record
>to a new document i.e. not print a document for one record.
>
>GA

Looking at it with a fresh mind. I think what I need to do is to get
some code that will loop through the records and on each occasion
print the report based on the current record in the loop.

Are there any pointers to code that will do that?

GA
Author
4 Jul 2009 5:41 PM
Tony Toews [MVP]
GA <talk2me@here.please> wrote:

>>Thanks for that. I am fine printing a report for a single record but I
>>don't want to do it manually several hundred times.
>>
>>I am trying to run the report unfiltered but have it print each record
>>to a new document i.e. not print a document for one record.
>>
>>GA
>
>Looking at it with a fresh mind. I think what I need to do is to get
>some code that will loop through the records and on each occasion
>print the report based on the current record in the loop.

Correct.  I thought the link I gave you had that info on it as well.
My apologies.  

See the Sample Code illustrating looping through a DAO recordset page
at the Access Email FAQ at
http://www.granite.ab.ca/access/email/recordsetloop.htm

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Granite Fleet Manager http://www.granitefleet.com/
Author
9 Jul 2009 3:25 PM
talk2me
Tony Toews [MVP] wrote:

Show quoteHide quote
> GA <talk2me@here.please> wrote:

> >>Thanks for that. I am fine printing a report for a single record but I
> >>don't want to do it manually several hundred times.
> >>
> >>I am trying to run the report unfiltered but have it print each record
> >>to a new document i.e. not print a document for one record.
> >>
> >>GA
> >
> >Looking at it with a fresh mind. I think what I need to do is to get
> >some code that will loop through the records and on each occasion
> >print the report based on the current record in the loop.

> Correct.  I thought the link I gave you had that info on it as well.
> My apologies.

> See the Sample Code illustrating looping through a DAO recordset page
> at the Access Email FAQ at
> http://www.granite.ab.ca/access/email/recordsetloop.htm

> Tony
> --
> Tony Toews, Microsoft Access MVP
> Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
> Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
> Granite Fleet Manager http://www.granitefleet.com/

Thanks again,

I've almost there with code and tidbits from various places including the
print to pdf from Stephen LeBans site. But one final problem exists. I get
separate pdf's, one for each record and all named correctly but every pdf
contains all pages of the report.

I need somehow to filter the recordset as each record is arrived at within
the loop.

My code is as follows -
-------------------------------
Private Sub Command3_Click()
On Error GoTo Err_Command3_Click

    Dim DB As Database
    Dim RSValues As DAO.Recordset
    Dim strDocName As String
    Dim blRet As Boolean
    Dim field As String

    Set DB = CurrentDb()
    Set RSValues = DB.OpenRecordset("TableName", dbOpenDynaset,
dbSeeChanges)
    strDocName = "ReportName"


    RSValues.MoveLast
    RSValues.MoveFirst

    While Not RSValues.EOF

            field = RSValues!FieldName
            blRet = ConvertReportToPDF(strDocName, vbNullString, field &
".pdf", False, False, 150, "", "", 0, 0, 0)
            RSValues.MoveNext

    Wend

Err_Command3_Click:
    MsgBox Err.Description

End Sub
-------------------------------
T.I.A. for any assistance - it's been a long day just this final hurdle.
GA

Bookmark and Share