Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Save Report as PDF

Posted on 2002-07-11
3
Medium Priority
?
268 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
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…

971 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