LAB 1
New Member
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 18155 pks00 280
Recognized Expert Contributor
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\re s\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:\myrepor ts"
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 knew db's and gave me long list
of things to do with that particular database, first thing being that
particular conversion. Truth is that I don't know a first thing about
db's, let alone using mysql... I downloaded mysql form www.mysql.com and...
|
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 4 to Service Pack 7
2) Set Subdatasheet Name to from
3) Shortened the file name of the .MDB file
4) Made sure the Track name AutoCorrect info is off
|
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 same as it
was in Access 2002?
I am running Access 2002 at the moment. Is there any reason for
testing purposes etc, for me to purchase Access 2003 if I am going to
recompile the Access 97 mdb files into Access 2000 format mde files
which...
|
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 my recordset did not.
i read from pasts posts that some references will not convert. so i
tried to change the dao 3.51 reference to dao 3.6 in access 97. then i
imported all of the objects into an access 2003. it did not work.
so my second...
|
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 database?
Why you ask! A client has a 2000 database. Currently using 2000 runtime for
most employees to work with database. A couple use 2003 to use database, no
problems. They have a mix of versions of other products such as Word,
Excel - 97,...
| |
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 already converted databases
to Access 2003? We also have 2 mda's, will these convert with no problem in
the mda format. We no longer have the mdb that made the mda. Are there any
other nuances that I need to look out for?
Thanks in advance,...
|
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 do not, and it's not clear
when they would get it. His thought was to use the upcoming Access 2007
runtime to allow the users who are still running Office 2003 to be able to
run the database.
While I use multiple versions of Access on my...
|
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 modules, only 2
out of 9 have copied across.
Do I need to do something special to recompile modules and take them
across to the new version? I thought the conversion process would just
handle it. Well it seems to for 2 of the 9 and I got no...
|
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. When converting the front ends
I get the following issues and error. If I try to import all the objects
into a blank Access 2003 shell I get a missing reference error for Outlook
2000, Excel 2000, and Word 2000 or after importing all the objects...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |