[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 478
  • Last Modified:

MS Access 2007 - Link to open a PDF

I have a form that has a graphic icon on the form. When the user click on the graphic icon I want to open a PDF file that I have stored in a subdirectory.

I would like someone to tell me the VBA code to use to open a PDF from the click event of an graphic icon on a form.

Thanks in advance for your assistance.
Ldufresne
0
Lou Dufresne
Asked:
Lou Dufresne
  • 2
  • 2
2 Solutions
 
lee555J5Commented:
In form Design View, add an Unbound Object Frame. In the wizard, select Create from File, check the Link checkbox, click Browse..., and navigate to your .pdf file. Check the Display as Icon checkbox if you want to see a generic pdf icon, or leave it clear if you want to see your file contents. Click OK. Still in Design View, select your new control and set its Enable property to Yes.
If you do it this way, you do not need VBA at all.
Lee
0
 
lee555J5Commented:
Enabled property
0
 
nicsaintCommented:
If you are looking for the actual code try this.
Shell "pdfApplicationPath pdfFilePath" , vBnormalFocus
Where pdfApplicationPath is the the location of the Adobe Reader program and pdfFilePath is the path and filename of the PDF you want to open
eg.
Shell "C:\program files\Adobe\Reader 9.0\AcroRd32.exe c:\Documents and Settings\Username\My Documents\MyPDF.pdf"

followed by the filename you want to open.
C:\Program Files\Adobe\Acrobat 6.0\Reader\AcroRd32.exe c:\temp\mypdf.pdf
0
 
nicsaintCommented:
The example above should have read
Shell "C:\program files\Adobe\Reader 9.0\AcroRd32.exe c:\Documents and Settings\Username\My Documents\MyPDF.pdf", vbNormalFocus
0
 
Lou DufresneIT Business Analyst CSM / Project ManagerAuthor Commented:
Both solutions worked fine. The solution that fit best for my needs was nicsaint's solution.

Thanks both of you for your expert assistance

Ldufresne
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now