473,626 Members | 3,389 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access 2003: Converting .snp files to .pdf files

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
Apr 9 '07 #1
2 18155
MMcCarthy
14,534 Recognized Expert Moderator MVP
Hi Lisa

Try this website. I haven't tried it but Stephen Lebans code is usually very good.

http://www.lebans.com/reporttopdf.htm
Apr 10 '07 #2
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"


Expand|Select|Wrap|Line Numbers
  1.  
  2. 'Read INI settings
  3. Declare Function GetPrivateProfileString Lib "kernel32" Alias _
  4.    "GetPrivateProfileStringA" (ByVal lpApplicationName As String, _
  5.    ByVal lpKeyName As Any, ByVal lpDefault As String, _
  6.    ByVal lpReturnedString As String, ByVal nSize As Long, _
  7.    ByVal lpFileName As String) As Long
  8.  
  9. 'Write settings
  10. Declare Function WritePrivateProfileString Lib "kernel32" Alias _
  11.    "WritePrivateProfileStringA" (ByVal lpApplicationName As String, _
  12.    ByVal lpKeyName As Any, ByVal lpString As Any, _
  13.    ByVal lpFileName As String) As Long
  14.  
  15. Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
  16.  
  17. Sub pdfwrite(reportname As String, destpath As String, Optional strcriteria As String)
  18.  
  19.     ' Runs an Access report to PDF995 to create a pdf file from the report.
  20.     ' Input parameters are the name of the report within the current database,
  21.     ' the path for the output file, and an optional criteria for the report
  22.  
  23.     ' Be sure to check that the "Generating PDF CS" setting in pdfsync.ini is set to 0
  24.     ' when pdf995 is idle. This codes uses that as a completion flag as it seems to be
  25.     ' the most reliable indication that PDF995 is done writing the pdf file.
  26.  
  27.  
  28.     ' Note: The application.printer object is not valid in Access 2000
  29.     ' and earlier. In that case, set the printer in the report to pdf995
  30.     ' and comment out the references herein to the application.printer
  31.  
  32.     Dim syncfile As String, maxwaittime As Long
  33.     Dim iniFileName As String, tmpPrinter As Printer
  34.     Dim outputfile As String, X As Long
  35.     Dim tmpoutputfile As String, tmpAutoLaunch As String
  36.  
  37. '***** IMPORTANT - SEE THIS *****
  38.     ' set the location of the PDF995.ini and the pdfsync files
  39.     iniFileName = "C:\Program Files\pdf995\res\pdf995.ini"
  40.     syncfile = "c:\documents and settings\all users\application data\pdf995\pdfsync.ini"
  41.  
  42.     ' build the output file name from the path parameter and the report name
  43.     If Mid(destpath, Len(destpath), 1) <> "\" Then destpath = destpath & "\"
  44.     outputfile = destpath & reportname & ".pdf"
  45.  
  46.     ' PDF995 operates asynchronously. We need to determine when it is done so we can
  47.     ' continue. This is done by creating a file and having PDF995 delete it using the
  48.     ' ProcessPDF parameter in its ini file which runs a command when it is complete.
  49.  
  50.     ' save current settings from the PDF995.ini file
  51.     tmpoutputfile = ReadINIfile("PARAMETERS", "Output File", iniFileName)
  52.     tmpAutoLaunch = ReadINIfile("PARAMETERS", "Autolaunch", iniFileName)
  53.  
  54.     ' remove previous pdf if it exists
  55.     On Error Resume Next
  56.     Kill outputfile
  57.     On Error GoTo Cleanup
  58.  
  59.     ' setup new values in PDF995.ini
  60.     X = WritePrivateProfileString("PARAMETERS", "Output File", outputfile, iniFileName)
  61.     X = WritePrivateProfileString("PARAMETERS", "AutoLaunch", "0", iniFileName)
  62.  
  63.     ' change the default printer to PDF995
  64.     ' if running on Access 2000 or earlier, comment out the next two lines
  65.     Set tmpPrinter = Application.Printer
  66.     Application.Printer = Application.Printers("PDF995")
  67.  
  68.     'print the report
  69.     DoCmd.OpenReport reportname, acViewNormal, , strcriteria
  70.  
  71.     ' cleanup delay to allow PDF995 to finish up. When flagfile is nolonger present, PDF995 is done.
  72.     Sleep (10000)
  73.     maxwaittime = 300000 'If pdf995 isn't done in 5 min, quit anyway
  74.     Do While ReadINIfile("PARAMETERS", "Generating PDF CS", syncfile) = "1" And maxwaittime > 0
  75.         Sleep (10000)
  76.         maxwaittime = maxwaittime - 10000
  77.     Loop
  78.  
  79.     ' restore the original default printer and the PDF995.ini settings
  80. Cleanup:
  81.     Sleep (10000)
  82.     X = WritePrivateProfileString("PARAMETERS", "Output File", tmpoutputfile, iniFileName)
  83.     X = WritePrivateProfileString("PARAMETERS", "AutoLaunch", tmpAutoLaunch, iniFileName)
  84.     X = WritePrivateProfileString("PARAMETERS", "Launch", "", iniFileName)
  85.     On Error Resume Next
  86.  
  87.     ' if running on Access 2000 or earlier, comment out the next line
  88.     Application.Printer = tmpPrinter
  89.  
  90. End Sub
  91.  
  92. Function ReadINIfile(sSection As String, sEntry As String, sFileName As String) As String
  93.  
  94.     Dim X As Long
  95.     Dim sDefault As String
  96.     Dim sRetBuf As String, iLenBuf As Integer
  97.     Dim sValue As String
  98.  
  99.     'Six arguments
  100.     'Explanation of arguments:
  101.     'sSection: ini file section (always between brackets)
  102.     'sEntry : word on left side of "=" sign
  103.     'sDefault$: value returned if function is unsuccessful
  104.     'sRetBuf$ : the value you're looking for will be copied to this buffer string
  105.     'iLenBuf% : Length in characters of the buffer string
  106.     'sFileName: Path to the ini file
  107.  
  108.     sDefault$ = ""
  109.     sRetBuf$ = String$(256, 0)   '256 null characters
  110.     iLenBuf% = Len(sRetBuf$)
  111.     X = GetPrivateProfileString(sSection, sEntry, _
  112.                sDefault$, sRetBuf$, iLenBuf%, sFileName)
  113.     ReadINIfile = Left$(sRetBuf$, X)
  114.  
  115. End Function
  116.  
  117.  
  118.  

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"
Apr 10 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

17
2885
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...
20
4625
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
1
5736
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...
4
2537
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...
2
2325
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,...
10
8373
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,...
17
7659
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...
3
2394
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...
3
2738
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...
0
8268
marktang
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...
0
8202
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,...
0
8707
Oralloy
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...
1
8366
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,...
0
8510
tracyyun
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...
0
7199
agi2029
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...
1
6125
isladogs
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...
0
4202
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1512
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.