Solved

Save Report as PDF

Posted on 2002-07-11
3
259 Views
Last Modified: 2007-12-19
I'm using the following code that I got from Experts to setup a report to print to PDF but it still sends the report to my default printer.  The fields in the DevStructure table just end up saying "Long Binary Data" so I'm not sure if the The PrtDevMode and PrtDevNames part is working.  I'm using Access 2000.  Any suggestions?
_________________________________________


Private Sub Command0_Click()
   
   Dim db As Database
   Dim rs As Recordset
   Dim rpt As Report
   Dim strReportName As String
   strReportName = "PDFSettings"
       
   DoCmd.OpenReport strReportName, acViewDesign
   
   Set db = CurrentDb
   Set rs = db.OpenRecordset("DevStructure")
   Set rpt = Application.Reports(strReportName)
   
   rs.AddNew
   rs.Fields(0) = rpt.PrtDevMode
   rs.Fields(1) = rpt.PrtDevNames
   rs.Update
   rs.Close
   
   DoCmd.Close acReport, strReportName, acSaveNo
   
End Sub

Now, next time you want to print a report to PDF, use the following code.

Private Sub Command1_Click()
   
   Dim db As Database
   Dim rs As Recordset
   Dim rpt As Report
   Dim strReportName As String
 
   strReportName = "REPORT_NAME"
   
   Set db = CurrentDb
   Set rs = db.OpenRecordset("DevStructure")
       
   DoCmd.OpenReport strReportName, acViewDesign
       
   Set rpt = Application.Reports(strReportName)
           
   rs.MoveFirst
   rpt.PrtDevMode = rs.Fields(0)
   rpt.PrtDevNames = rs.Fields(1)
   rs.Close
   
   DoCmd.OpenReport strReportName, acViewNormal
   DoCmd.Close acReport, strReportName, acSaveNo
   
End Sub
0
Comment
Question by:drees727
3 Comments
 

Author Comment

by:drees727
ID: 7146705
I solved my own problem.  I changed my report to print to Docucom PDF Driver instead of PDF Writer and now it seems to work.
0
 
LVL 54

Expert Comment

by:nico5038
ID: 7281311

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
 - PAQ'd and pts refunded
Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

Nic;o)
0
 

Accepted Solution

by:
ComTech earned 0 total points
ID: 7314807
This question will be placed in PAQ and points refunded.

Best regards,
ComTech
Community Support
Administrator @ EE
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question