Solved

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

Posted on 2014-04-13
7
867 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
ID: 39997542
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
ID: 39998775
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
ID: 39998899
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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:SteveL13
ID: 39999112
Getting error:

File not found
0
 
LVL 84
ID: 39999194
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
ID: 39999354
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
ID: 39999360
Does acrobat generate that error?  If not, perhaps you need to use the full path of adobe acrobat in your code?
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

810 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