Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Printing MS-Access-Report to PDF without Save-As-Dialogbox

Posted on 2004-10-18
8
Medium Priority
?
1,326 Views
Last Modified: 2013-12-02
Although this theme has already been discussed I have still no soution found for my problem.
I use WindowsXP with SP2, MS Office Prof 2000 and have installed Acrobat 6.0 Prof. (full version). Now I want to print the report from my Access-application to the PDF-Writer. Therefore I entered in the Registry the key which holds the desired filename and another key with the bDocInfo containing a zero. But every time I want to print the report will be generated but I am asked for the filename. In the meantime I did visit a lot of interesting internet pages but without success. It seems that Adobe has made serious changes in his PDF-Writer so the examples I found are now no more working.

The code is as follows:
    'Save current default printer
    sMyDefPrinter = bGetRegValue(HKEY_CURRENT_USER, "Software\Microsoft\WIndows NT\CurrentVersion\Windows", "Device")
   
    ' Set default printer to PDF Writer
    bSetRegValue HKEY_CURRENT_USER, "Software\Microsoft\Windows NT\CurrentVersion\Windows", "Device", "Adobe PDF"

    'Setting value for PDFFileName in the registry stops file dialog box from appearing
    bSetRegValue HKEY_CURRENT_USER, "Software\Adobe\Adobe PDF", "PDFFileName", sPDFPath + sPDFName
    bSetRegValue HKEY_CURRENT_USER, "Software\Adobe\Adobe PDF", "bDocInfo", 0

    DoCmd.OpenReport rptName, acViewNormal

    ' Restore default printer
    bSetRegValue HKEY_CURRENT_USER, "Software\Microsoft\WIndows NT\CurrentVersion\Windows", "Device", sMyDefPrinter

While running the program the entries in the registry are be done, printer switches to Adobe but the File Save Dialog Box still appears!

Any suggestions? Any help?
Thanks a lot for your comments.
Traindog

0
Comment
Question by:Traindog
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 27

Expert Comment

by:jjafferr
ID: 12342262
Hi Traindog,

Have a look here:
http://www.experts-exchange.com/Databases/MS_Access/Q_21078898.html

I hope this helps,

jaffer
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 12342593
You should be able to alter the properties of the PDF printer to bypass the save dialog (open the printer and go Printer->Properties), but this is another reason I no longer use Acrobat.
0
 
LVL 51

Accepted Solution

by:
Gustav Brock earned 336 total points
ID: 12345665
If you don't insist on using Adobe, you may wish to study FreePDF:

  http://freepdfxp.de/fpxp.htm

It is totally free and uses Ghostscript and the Apple Postscript driver.
Be sure to download the "Administration Manual" as well as the sources (some basic code samples) and perhaps even the multidocument option.

/gustav
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 27

Assisted Solution

by:jjafferr
jjafferr earned 332 total points
ID: 12392682


Here is a neat trick from
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20381304.html

What is happening here is:
1- You print your Report to Ms Word, here is an example on how to do that:
http://www.experts-exchange.com/Databases/MS_Access/Q_21023384.html

2- then print to pdf from Word.


reference ms word object library and acrobat distiller under project/references:

Dim obj As New Word.Application
Dim objDistiller As New ACRODISTXLib.PdfDistiller

obj.Documents.Open "C:\my documents\Test.doc"
obj.ActivePrinter = "Acrobat Distiller"
obj.PrintOut False, False, False, "C:\windows\desktop\Test.ps", , , , , , , True
obj.Quit False
Set obj = Nothing

objDistiller.FileToPDF "C:\windows\desktop\Test.ps", "c:\windows\desktop\Test.pdf", ""
Set objDistiller = Nothing



jaffer
0
 
LVL 44

Assisted Solution

by:Karl Heinz Kremer
Karl Heinz Kremer earned 332 total points
ID: 12392744
0
 
LVL 27

Expert Comment

by:jjafferr
ID: 12392869
khkremer, thanks for accepting my request to help here, much appreciated.

I have 2 suggestion:
1- Although EVERYBODy hates SendKeys, but it might get the job done here,
So when the Save dialog comes up, we Sendkey with the file Name and path, then sendkey for Carriage Return:

strAttach = "\\Torrdata\Manufacturing\RMR_Data\RMRs\RMR" & Me.RMRNum & ".pdf"
DoCmd.OpenReport "rptRMR", acnormal
SendKeys strAttach, False
SendKeys "{Enter}", False

2- Some good discussion and solutions too:
http://www.tek-tips.com/faqs.cfm?fid=1635
http://www.tek-tips.com/viewthread.cfm?qid=816439

jaffer
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Sometimes we receive PDF files that are in the wrong orientation. They may be sideways or even upside down. This most commonly happens with scanned or faxed documents. It is possible to rotate the view of these PDFs with the free Adobe Reader produc…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

664 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