Print Page | Close Window

Print Selected page of Access reports

Printed From: www.exp-systems.com
Category: PDF reDirect
Forum Name: Programming
Forum Discription: VBA and Batch Tools to control PDF reDirect Pro
URL: http://www.exp-systems.com/Forum_exp/forum_posts.asp?TID=780
Printed Date: 22 Nov 24 at 9:06AM


Topic: Print Selected page of Access reports
Posted By: plunavat
Subject: Print Selected page of Access reports
Date Posted: 08 Sep 11 at 2:31PM
Hello,
 
I am using PDF reDirect to print reports to pdf from MS Access.
I need to print selected page of the multipage reports (eg- 2,3,6,8).
Can anyone help me to acheive this..
 
Also if possible let me know the VBA code for the same
 
Thanks & Regards,
Pranav



Replies:
Posted By: Michel_K17
Date Posted: 12 Sep 11 at 12:09AM
Hi,

   No, I do not know of any way to do what you are asking.

   Closest I got was to google your question and I found [ http://www.accessmonster.com/Uwe/Forum.aspx/access/129483/Open-print-selected-pages-of-PDF-document - this ], but it sounds like they were not able to do it either.

   Best regards,



-------------
Michel Korwin-Szymanowski
EXP Systems LLC


Posted By: plunavat
Date Posted: 12 Sep 11 at 12:34AM
Thanks Michel for your reply..
 
I think there is some confusion.
I want to print MS Access Reports. The data of the report is coming from database itself. This Report is multipage.
 
As of now when i print this report the complete report is printed and saved as pdf through PDF ReDirect. This is working perfectly. The VBA code for the same is,
 
code--- <Convert2Pdf MyDocumentName, MyBatchPrinter, MyOutputPath, MyOutputFilename, True, True>
 
I want to print selected page of the report say (first 2 page only). something like this is possible??
 
code--- <Convert2Pdf MyDocumentName(page 1, 2), MyBatchPrinter , MyOutputPath, MyOutputFilename, True, True>
 
Regards,
Pranav


Posted By: Michel_K17
Date Posted: 12 Sep 11 at 10:48PM
Hi,

   I checked the documentation of VBA Access, and there is a command called the "PrintOut" action which you can use to print a report, and includes the option to print a page range.

   This seems like a new command (I have Access 2010). Please search (in VBA for Access) for "PrintOut Macro Action", and it should give you the instructions you need. Here is a [ http://office.microsoft.com/en-us/access-help/printout-macro-action-HA001226272.aspx - link ] with more info.

   All you need to do now is to modify my code to use this command. Modify the Function called "PrintOutputToBatchPrinter" like this (sample - you will need to use variables to set your page ranges in the future:

    
     '-------------------------------------------------------------
     ' Create the PDF by sending the Print Job to the Batch Printer
     '-------------------------------------------------------------
     ' Note: I received a report from someone who was having a problem
     ' printing his Access report. The first few records were being
     ' repeated/duplicated on the second page. Although I did not figure
     ' out why this problem occured, I was able to fix the problem by
     ' generating a "Preview" first before printing. (see below)
    
     DoCmd.OpenReport MyDocumentName, acViewPreview  ' Generate a Preview First

     ' OLD COMMAND
     ' DoCmd.OpenReport MyDocumentName, acViewNormal   ' Print the Report

     ' NEW COMMAND WITH PRINT RANGE 1 to 2
     DoCmd.PrintOut acPages, 1, 2




   Cheers!




-------------
Michel Korwin-Szymanowski
EXP Systems LLC


Posted By: Goodwinm
Date Posted: 31 Oct 11 at 6:50AM
Hi Plunavat,

I think there may be a roundabout way to do this - in Access - depending on the underlying database structure.

I'm assuming the page selections are ad-hoc but I'm hoping there might be some way to exploit existing fields or create new ones that mirror the circumstances or your page choices.

If that's the case, then it should be possible for you to reconfigure your Access report so that there is an added selection criteria reflecting those field(s) and which would generate a pop-up input request. & so the Report gets limited to just those pages you want printed. (The'll be numbered 1,2,3 though)

just a thought



Posted By: Goodwinm
Date Posted: 31 Oct 11 at 6:57AM
And even if its not possible to predict the circumstances that might give rise to future page choices, a special field, say like "Ad_Hoc_Printing", with values Yes/No, should do the trick. All you'd need is an Update Query routine that'll let you check/uncheck which records are to filtered in your Report.

M.



Print Page | Close Window