Solved

Save Report as PDF

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

821 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