Link to home
Start Free TrialLog in
Avatar of JMSSystems
JMSSystems

asked on

Print existing PDF File From Microsoft Access

I am writing an Access application which generates a contract.  Appendix B of the contract is a pre-existing PDF file.  How can I make the PDF file print (or print preview) when the user goes to print the contract?
Avatar of Mike Eghtebas
Mike Eghtebas
Flag of United States of America image

Try:
   
    Dim PdfPath As String
   
    PdfPath = "C:\Program Files\Adobe\Acrobat 5.0\Reader\AcroRd32.exe C:\MyFolder\Contract.pdf"
   
    Shell PdfPath, vbNormalFocus

Mike E.
ASKER CERTIFIED SOLUTION
Avatar of Jim_Bob_Joe
Jim_Bob_Joe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JMSSystems
JMSSystems

ASKER

Comment For eghtebas: Thank you very much for taking the time to answer my question.  I tried your suggestion, and it did open the pdf file in ADOBE.  I did however have two concerns with your answer.  First, the user has to take the extra step of clicking the Print button in ADOBE if they want to print it.  Second, the hardcoded reference to the "Acrobat 5.0" folder would be a problem when the user upgrades to Acrobat 6.0 in that the code would have to be changed (although I suppose you might be able to keep the ADOBE software in a set of folders with names that don't change with newer versions).  Thanks again for answering.

Comment For Jim_Bob_Joe:  Your answer was exactly what I was looking for.  Both the Preview and Print worked great.  One small correction... In the "Print" code, where you have "DB2.MDB", it should have been "C:\MyFolder\MyPDFFile.pdf"  Thanks very much for answering my question.
Yeah i had just copied the code from my database and change the first one but forgot to change the open file in the print sorry.

Well happy DB'in

Jim