Open a PDF file from a Form

A

Alan

Hope someone can help. Is it possible to set up so if you click on a
command button it opens a PDF document without having to specify what
software opens the PDF file. Many thanks.
 
O

Ofer

Yes, use the FollowHyperlink

Application.FollowHyperlink "c:\FileName.pdf"

It will open the application as it set up in windows.
 
A

Alan

Thanks for the reply, would it be possible to get the path for the PDF file
from a field in a table as well as the name of the file. Any sample code to
point me in the right direction would be great.
 
O

Ofer

Just an example, without knowing how you Db is build
============================
Dim PathName As String, FileName as String
PathName = Dlookup("[Path field name]","[Table Name]")
FileName = Dlookup("[File field name]","[Table Name]")

Application.FollowHyperlink PathName & FileName
============================
 
Top