Solved

Save Report as PDF

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server views 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 Microsoft Access…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

706 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

20 Experts available now in Live!

Get 1:1 Help Now