If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Report - how to print each page to new document.
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 |
#2
|
|||
|
|||
Report - how to print each page to new document.
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 wrote: 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 |
#3
|
|||
|
|||
Report - how to print each page to new document.
GA 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/emai...ttachments.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/ |
#4
|
|||
|
|||
Report - how to print each page to new document.
On Fri, 03 Jul 2009 20:24:07 -0600, "Tony Toews [MVP]"
wrote: GA 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/emai...ttachments.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 |
#5
|
|||
|
|||
Report - how to print each page to new document.
On Sat, 04 Jul 2009 10:24:08 +0100, GA wrote:
On Fri, 03 Jul 2009 20:24:07 -0600, "Tony Toews [MVP]" wrote: GA 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/emai...ttachments.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 |
#6
|
|||
|
|||
Report - how to print each page to new document.
GA 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/ |
#7
|
|||
|
|||
Report - how to print each page to new document.
Tony Toews [MVP] wrote:
GA 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 |
#9
|
|||
|
|||
Report - how to print each page to new document.
On Sat, 11 Jul 2009 00:37:49 -0600, "Tony Toews [MVP]" wrote: (GA) wrote: I get separate pdf's, one for each record and all named correctly but every pdf contains all pages of the report. From the page on my initial posting. However you can not pass a filter or where clause as you would in a standard Open report command in VBA when outputting the report to a file. Therefore you must change the filter in the reports OnOpen event. Me.Filter = "Shipment SId=" & Forms![Select Load List]![LoadID] Me.FilterOn = True Tony Tony - firstly very many thanks for your help. It is much appreciated. In the end and out of frustration due to my own shortcomings, I reverted to the methods I know and I used a form. I used a parameterised query for the report based on a form control and then used the form timer to - 1 Print the report 2 Move to next record 3 And If Me.NewRecord stop the timer Clunky but it worked. GA |
#10
|
|||
|
|||
Report - how to print each page to new document.
GA wrote:
In the end and out of frustration due to my own shortcomings, I reverted to the methods I know and I used a form. I used a parameterised query for the report based on a form control and then used the form timer to - 1 Print the report 2 Move to next record 3 And If Me.NewRecord stop the timer Clunky but it worked. Yup, that would work too. Glad you got things going. 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/ |
Thread Tools | |
Display Modes | |
|
|