Tom Ross said:
Hi
I would like to open a pdf file when a user clicks on a field in my form
I can assemble the address for the file in code
"S:\procedures\manufacturing\x51-2.pdf" etc
How do I have that file opened in VBA Code.
Thanks
Tom
Hi Tommy,
Into forms there are controls, fields are only in queries and tables.
if you are able to put the name of the pdf file in a text box named f in
your form try this solution :
Dim ret As Integer
ret = Shell("rundll32.exe url.dll,FileProtocolHandler " & Me.f,
vbMaximizedFocus)
the second way that I can suggest you is the API shellExecute, but I think
that the previous way is more simply :
Private Declare Function ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" _
(ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String,
ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Const SW_SHOWNORMAL = 1
MyPath=hereYourPath
ShellExecute Me.hWnd, "Open", Me.f, vbNullString, MyPath, SW_SHOWNORMAL
Ciao, Sandro