Access Reports to PDF format (1 Viewer)

jtvcs

Registered User.
Local time
Today, 02:51
Joined
Apr 10, 2003
Messages
97
We've been looking at two products which allow selection to print PDF files from an Access Report when printing. What we would like to know has anybody used either of these products and most importantly can either (or another) be programmed using a macro or VB code to bypass the SAVE AS window ? Thanks for your answers.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 07:51
Joined
Jul 9, 2003
Messages
16,428
Found Here...

********************************************
Installing Ghostscript to output from Access
********************************************

Download Ghostscript 8.00 from http://www.cs.wisc.edu/~ghost/

Install Ghostscript and make a note of the install directory.

Create a directory in the Ghostscript directory named Output
e.g. c:\gs\output

Install MakePDf in the Ghostscript directory
(Note MakePDF is not actually used from the Access functions
but is a useful standalone facility)

Create a new local printer using a postscript driver, my
personal choice is HP Deskjet 1200C/PS.

Create a new local printer port as c:\gs\output\tfile.ps

Set the spool options on the printer to print directly to the
printer. This is important otherwise Ghostscript kicks in before
the printer file is output.

Rename the printer as 'Postscript'

That finishes installing Ghostscript.


Import the Access modules supplied into your application.
If the Ghostscript version is anything other than version 8.00 then
a line in the PDF module will need to be modified:

Public Function GhostscriptIt(A_reportname, A_where)
Dim gsdir As String, gsscript As String
'gsdir MUST POINT TO THE LATEST INSTALLATION DIRECTORY OF GHOSTSCRIPT
gsdir = "c:\gs\gs8.00\"

*******************************
USING IT
*******************************

To PRINT a report to file then call the following function

SaveASpdfFile(A_reportname, A_where)

A_reportname = Report you want to output. This should be set up with the printer
set to 'Postscript' (In page setup>use specific printer).
A_where = The where condition for your report.

To EMAIL any report as a pdf attachment then call the following function

MailAsPDFAttachment(A_reportname, A_where, A_to, A_subject, A_body, A_sendnow)

A_reportname = Report you want to output. This should be set up with the printer
set to 'Postscript' (In page setup>use specific printer).
A_where = The where condition for your report.
A_to = The recipients
A_subject = The subject line for your email
A_body = Any body text you wish to add
A_sendnow = True or False. If false (or if there are no recipients) then the
email will be displayed, otherwise it will just be sent.

There are no optional parameters so if say there is no body text just use empty
quotes i.e.""

The function assumes you are using Outlook as your mail client. It has been tested
on Outlook 98 and 2000.

Please report any problems back to me via my private post at Utter Access
 
K

ksalvite

Guest
Access Reports to PDF format questions

Hello,

I am stuck hereSee below)

I put this is my module;
Public Function GhostscriptIt(A_reportname, A_where)
Dim gsdir As String, gsscript As String
gsdir = "c:\gs\gs8.50\"
End Function

Public Function SaveASpdfFile(A_reportname, A_where)
A_reportname = "rptFirstRFQsend"
A_where = Forms![frmFirstRFQ]![RFQTWAID]

Public Function MailAsPDFAttachment(A_reportname, A_where, A_to, A_subject, A_body, A_sendnow)

End Function


This is the code I use to attach and send an RTF report:

strDocName = "rptFirstRFQsend"
strMailSubject = "New RFQ for P/N" & Forms!frmFirstRFQ!PartNo + " - " & Forms!frmFirstRFQ!InstrList!OriginalItemText
strMsg = "The attached RFQ has been requested. If applicable, please check your RFQ Inbox."
DoCmd.SendObject ObjectType:=acSendReport, _
ObjectName:=strDocName, outputformat:=acFormatRTF, _
To:=Forms!frmFirstRFQ!cmbToolEng, Subject:=strMailSubject, MessageText:=strMsg


Am I close?
Thank you.
Ken
 

DocNice

Registered User.
Local time
Yesterday, 23:51
Joined
Oct 6, 2004
Messages
76
Here's a quick and easy way if you already have Acrobat Standard or Pro installed on your system:

' Set printer to Adobe PDF
Set Application.Printer = Application.Printers("Adobe PDF")

'Open report in (my default is print view)
DoCmd.OpenReport "rptSvcList"

' Reset printer to default
Set Application.Printer = Application.Printers(0)


To bypass the "Save As" window, you'll need to set up a new port on your printer. To do this, go to the printers control panel, right click on Adobe PDF, and click properties. From there, go to the Ports tab, and add a new port, typing in the name of the folder where you want the PDFs saved. You have to have one PDF folder, it cannot change over and over without prompting.

Once you have that, go back to the printer control panel, right click, and this time click on "Printing Preferences." Uncheck the Prompt for PDF Filename box, and this will allow you to save in a default folder.

If you need to have a different folder every time, just program VBA to move the file once it's printed. You'll have to tell VBA to check every 5 seconds or so to see if the file has been created before telling it to move the file.
 

Users who are viewing this thread

Top Bottom