Solved

How open pdf file from command button onclick at a certain size

Posted on 2014-04-13
7
834 Views
Last Modified: 2014-04-17
An expert helped me with a question a couple of days ago.  Here is the code he suggested which works very well.  But now I would like the pdf to open at 75% size.  How can the following code be altered to accomplish this?

private sub button_click()
DoCmd.OutputTo acOutputReport, "rptTable2", acFormatPDF, CurrentProject.Path & "\myReport.pdf"
FollowHyperlink CurrentProject.Path & "\myReport.pdf"
end sub


--Steve
0
Comment
Question by:SteveL13
  • 3
  • 2
  • 2
7 Comments
 
LVL 10

Expert Comment

by:Korbus
Comment Utility
your will need to adjust the "followhyperlink" line to actually call adobe reader with certain command line parameters, one will specify zoom, one will specify the file.

http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf

e.g.

Acrobat.exe /A "zoom=75" "C:\example.pdf"

or for adobe reader...

AcroRd32.exe  /A "zoom=75" "C:\example.pdf"
0
 

Author Comment

by:SteveL13
Comment Utility
I'm sorry I don't follow.

How do I alter my code to make the report open at 75% size?
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
Comment Utility
Instead of using FollowHyperlink use the Shell function. I believe the following syntax will work:

Shell Chr(34) & "AcroRd32.exe /A " & Chr(34) & "Zoom=75" & Chr(34) & " " & Chr(34) & CurrentProject.Path & "\myReport.pdf" & Chr(34) & Chr(34)

Open in new window

Chr(34) is the double quote character, so essentially you're inserting that character every time you see Chr(34).
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:SteveL13
Comment Utility
Getting error:

File not found
0
 
LVL 84
Comment Utility
Then your path is wrong. Can you show us the full code you're using?

Often it's a good idea to pop up a msgbox when you're troubleshooting these things to make sure the path is right. You can do this to view the value you're passing to the Shell command:

Msgbox Chr(34) & "AcroRd32.exe /A " & Chr(34) & "Zoom=75" & Chr(34) & " " & Chr(34) & CurrentProject.Path & "\myReport.pdf" & Chr(34) & Chr(34)

Open in new window

0
 

Author Comment

by:SteveL13
Comment Utility
Private Sub Command310_Click()
On Error GoTo Command310_Click_Err

    DoCmd.RunCommand acCmdSaveRecord

    GettingFilesInDir TempVars!strPicturesDataPath, Me.txtNCMRCARPAR

    DoCmd.OutputTo acOutputReport, "Non-Conform Materials", acFormatPDF, CurrentProject.Path & "\Non-Conform Materials.pdf"
   
    'Shell Chr(34) & "AcroRd32.exe /A " & Chr(34) & "Zoom=75" & Chr(34) & " " & Chr(34) & CurrentProject.Path & "\Non-Conform Materials.pdf" & Chr(34) & Chr(34)
   
    FollowHyperlink CurrentProject.Path & "\Non-Conform Materials.pdf"

Command310_Click_Exit:
    Exit Sub

Command310_Click_Err:
    MsgBox Error$
    Resume Command310_Click_Exit

End Sub
0
 
LVL 10

Expert Comment

by:Korbus
Comment Utility
Does acrobat generate that error?  If not, perhaps you need to use the full path of adobe acrobat in your code?
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

771 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now