Solved

Save Report as PDF

Posted on 2002-07-11
3
256 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
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 …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

910 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now