I'm using an app designed in Access 2003 which exports a report into a .snp file. We are manually converting the snp files into pdf. I'll looking for away to convert the files from snp to pdf automatically via Access. I believe the Adobe Distiller linked to Access would automate this for us but I do not know how to link Access to the Distiller so a pdf is created. Does anyone know how to do this?
Thanks
Lisa
2 18108
Hi Lisa
What I have used successfully in the past is PDF995. I have vba code that allows you to print your report as PDF using PDF995
Add the following to a module, note u would need to tweak this to reflect the path where you have installed it - read the comments within the procedure called pdfwrite
i.e.
'***** IMPORTANT - SEE THIS *****
' set the location of the PDF995.ini and the pdfsync files
iniFileName = "C:\Program Files\pdf995\res\pdf995.ini" -
-
'Read INI settings
-
Declare Function GetPrivateProfileString Lib "kernel32" Alias _
-
"GetPrivateProfileStringA" (ByVal lpApplicationName As String, _
-
ByVal lpKeyName As Any, ByVal lpDefault As String, _
-
ByVal lpReturnedString As String, ByVal nSize As Long, _
-
ByVal lpFileName As String) As Long
-
-
'Write settings
-
Declare Function WritePrivateProfileString Lib "kernel32" Alias _
-
"WritePrivateProfileStringA" (ByVal lpApplicationName As String, _
-
ByVal lpKeyName As Any, ByVal lpString As Any, _
-
ByVal lpFileName As String) As Long
-
-
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
-
-
Sub pdfwrite(reportname As String, destpath As String, Optional strcriteria As String)
-
-
' Runs an Access report to PDF995 to create a pdf file from the report.
-
' Input parameters are the name of the report within the current database,
-
' the path for the output file, and an optional criteria for the report
-
-
' Be sure to check that the "Generating PDF CS" setting in pdfsync.ini is set to 0
-
' when pdf995 is idle. This codes uses that as a completion flag as it seems to be
-
' the most reliable indication that PDF995 is done writing the pdf file.
-
-
-
' Note: The application.printer object is not valid in Access 2000
-
' and earlier. In that case, set the printer in the report to pdf995
-
' and comment out the references herein to the application.printer
-
-
Dim syncfile As String, maxwaittime As Long
-
Dim iniFileName As String, tmpPrinter As Printer
-
Dim outputfile As String, X As Long
-
Dim tmpoutputfile As String, tmpAutoLaunch As String
-
-
'***** IMPORTANT - SEE THIS *****
-
' set the location of the PDF995.ini and the pdfsync files
-
iniFileName = "C:\Program Files\pdf995\res\pdf995.ini"
-
syncfile = "c:\documents and settings\all users\application data\pdf995\pdfsync.ini"
-
-
' build the output file name from the path parameter and the report name
-
If Mid(destpath, Len(destpath), 1) <> "\" Then destpath = destpath & "\"
-
outputfile = destpath & reportname & ".pdf"
-
-
' PDF995 operates asynchronously. We need to determine when it is done so we can
-
' continue. This is done by creating a file and having PDF995 delete it using the
-
' ProcessPDF parameter in its ini file which runs a command when it is complete.
-
-
' save current settings from the PDF995.ini file
-
tmpoutputfile = ReadINIfile("PARAMETERS", "Output File", iniFileName)
-
tmpAutoLaunch = ReadINIfile("PARAMETERS", "Autolaunch", iniFileName)
-
-
' remove previous pdf if it exists
-
On Error Resume Next
-
Kill outputfile
-
On Error GoTo Cleanup
-
-
' setup new values in PDF995.ini
-
X = WritePrivateProfileString("PARAMETERS", "Output File", outputfile, iniFileName)
-
X = WritePrivateProfileString("PARAMETERS", "AutoLaunch", "0", iniFileName)
-
-
' change the default printer to PDF995
-
' if running on Access 2000 or earlier, comment out the next two lines
-
Set tmpPrinter = Application.Printer
-
Application.Printer = Application.Printers("PDF995")
-
-
'print the report
-
DoCmd.OpenReport reportname, acViewNormal, , strcriteria
-
-
' cleanup delay to allow PDF995 to finish up. When flagfile is nolonger present, PDF995 is done.
-
Sleep (10000)
-
maxwaittime = 300000 'If pdf995 isn't done in 5 min, quit anyway
-
Do While ReadINIfile("PARAMETERS", "Generating PDF CS", syncfile) = "1" And maxwaittime > 0
-
Sleep (10000)
-
maxwaittime = maxwaittime - 10000
-
Loop
-
-
' restore the original default printer and the PDF995.ini settings
-
Cleanup:
-
Sleep (10000)
-
X = WritePrivateProfileString("PARAMETERS", "Output File", tmpoutputfile, iniFileName)
-
X = WritePrivateProfileString("PARAMETERS", "AutoLaunch", tmpAutoLaunch, iniFileName)
-
X = WritePrivateProfileString("PARAMETERS", "Launch", "", iniFileName)
-
On Error Resume Next
-
-
' if running on Access 2000 or earlier, comment out the next line
-
Application.Printer = tmpPrinter
-
-
End Sub
-
-
Function ReadINIfile(sSection As String, sEntry As String, sFileName As String) As String
-
-
Dim X As Long
-
Dim sDefault As String
-
Dim sRetBuf As String, iLenBuf As Integer
-
Dim sValue As String
-
-
'Six arguments
-
'Explanation of arguments:
-
'sSection: ini file section (always between brackets)
-
'sEntry : word on left side of "=" sign
-
'sDefault$: value returned if function is unsuccessful
-
'sRetBuf$ : the value you're looking for will be copied to this buffer string
-
'iLenBuf% : Length in characters of the buffer string
-
'sFileName: Path to the ini file
-
-
sDefault$ = ""
-
sRetBuf$ = String$(256, 0) '256 null characters
-
iLenBuf% = Len(sRetBuf$)
-
X = GetPrivateProfileString(sSection, sEntry, _
-
sDefault$, sRetBuf$, iLenBuf%, sFileName)
-
ReadINIfile = Left$(sRetBuf$, X)
-
-
End Function
-
-
-
Now to call it, just call pdfwrite
eg pass in report name and folder where u want it dumped to
pdfwrite "Report1", "c:\myreports"
Sign in to post your reply or Sign up for a free account.
Similar topics
by: chicha |
last post by:
Hey people,
I have to convert MS Access 2000 database into mysql database, the whole
thing being part of this project I'm doing for one of my faculty
classes. My professor somehow presumed I...
|
by: John |
last post by:
Hi,
I've recently upgraded from Access 97 to Access 2002 & the performance
basically stinks. I have tried the following items listed below but it
has only had a minor impact:
1) Upgraded Jet...
|
by: Wayne Aprato |
last post by:
I have a client who is running several Access 97 databases that I have
written for them. They are about to upgrade to Access 2003. Is the
default file format of Access 2003 still Access 2000 the...
|
by: JMCN |
last post by:
object invalid or no longer set - confusion of the recordset in access
2003.
i am currently converting from access 97 to access 2003. majority of
the codes converted over perfectly fine, though...
|
by: Jeff |
last post by:
Does anyone know of any potential problems running a 2000 database with
2003?
Also, what about installing all other Office products as 2003 versions but
leaving Access as 2002 running a 2000...
|
by: NEWSGROUPS |
last post by:
I work for an organization that is migrating from Access 2000 to Access
2003. About 5 or 6 years ago we migrated from Access 97 to Access 2000 with
no problem. Will I have trouble converting these...
|
by: Neil |
last post by:
A client of mine likes some of the new bells and whistles in Access 2007,
and is thinking about converting our A03 format MDB to an A07 format file.
However, while some of the users have A07, many...
|
by: Roy Tong |
last post by:
I maintain a shared database on Access 97. I've just tried converting
a test copy of the database to 2003 and it appeared to work OK. That
is I got no error messages. However then I look at my...
|
by: NEWSGROUPS |
last post by:
I am in the midst of trying to convert about 25 Access 2000 to Access 2003.
The new environment consists of Office/Access 2003 and Outlook 2003. When
converting the back ends I have no problems....
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |