?
Solved

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

Posted on 2014-04-13
7
Medium Priority
?
973 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 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:SteveL13
ID: 39999112
Getting error:

File not found
0
 
LVL 85
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

755 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