How to open a pdf file by using the access form (1 Viewer)

usmani_global

New member
Local time
Today, 17:33
Joined
May 24, 2008
Messages
1
Dear Sir

Our company is involved in customs clearance. we often use to search/view the pdf files in various range. the question is that how can i open a pdf file in access form
for example i have a pdf file namely "12-05-08" in "rate sheet" folder in my document. If i design a form in which there is a combo box showing all the files in that specific folder, How can i view this file by clicking preview report.
 

Kiwiman

Registered User
Local time
Today, 14:33
Joined
Apr 27, 2008
Messages
799
Howzit

This works for me - I have this code that opens any document I have tried to date (Excel, Word, PDF, txt) which is the code on a command button on a form

Code:
Private Sub cmdView1_Click()
Call OpenDocument(Me.Attach1) ' Me.Attach1 holds the file pathname
End Sub

The code below is a module that is called from the form wanting to view the file

Code:
Public Sub OpenDocument(DocPath As String)
Dim A As Long
A = Shell("RUNDLL32.EXE URL.DLL,FileProtocolHandler " & DocPath, vbMaximizedFocus)
End Sub
 

matsuir

New member
Local time
Today, 03:33
Joined
Jun 4, 2008
Messages
3
U can hyperlink it
 

Daveyk01

Registered User.
Local time
Today, 06:33
Joined
Jul 3, 2007
Messages
144
Howzit

This works for me - I have this code that opens any document I have tried to date (Excel, Word, PDF, txt) which is the code on a command button on a form

Code:
Private Sub cmdView1_Click()
Call OpenDocument(Me.Attach1) ' Me.Attach1 holds the file pathname
End Sub

The code below is a module that is called from the form wanting to view the file

Code:
Public Sub OpenDocument(DocPath As String)
Dim A As Long
A = Shell("RUNDLL32.EXE URL.DLL,FileProtocolHandler " & DocPath, vbMaximizedFocus)
End Sub

Fantastic Tip!!!
 

forman

Registered User.
Local time
Today, 14:33
Joined
Jul 30, 2002
Messages
12
Open PDF

Hi Kiwiman

Can you clarify where the two pieces of code sholud be, I'm assuming that the first code is attached to the 'On Click' of the button, but I'm stuck on the second piece of code.

Thanks

Alan
 

Daveyk01

Registered User.
Local time
Today, 06:33
Joined
Jul 3, 2007
Messages
144
Hi Kiwiman

Can you clarify where the two pieces of code sholud be, I'm assuming that the first code is attached to the 'On Click' of the button, but I'm stuck on the second piece of code.

Thanks

Alan

I put it in a support module that has a while bunch of other pulic functions and subs.
 

forman

Registered User.
Local time
Today, 14:33
Joined
Jul 30, 2002
Messages
12
Thanks

Thanks for that, going to play with it now

Alan
 

gbuckton

Registered User.
Local time
Today, 09:33
Joined
Aug 20, 2008
Messages
38
Howzit

This works for me - I have this code that opens any document I have tried to date (Excel, Word, PDF, txt) which is the code on a command button on a form

Code:
Private Sub cmdView1_Click()
Call OpenDocument(Me.Attach1) ' Me.Attach1 holds the file pathname
End Sub
The code below is a module that is called from the form wanting to view the file

Code:
Public Sub OpenDocument(DocPath As String)
Dim A As Long
A = Shell("RUNDLL32.EXE URL.DLL,FileProtocolHandler " & DocPath, vbMaximizedFocus)
End Sub

Can someone please tell me where the 'Me.Attach1' code should go, and what it should look like?

I'm guessing its something like:

Me.Attach1 = C:\folder\docname.pdf

thanks,
 

gbuckton

Registered User.
Local time
Today, 09:33
Joined
Aug 20, 2008
Messages
38
Just as an FYI, I've found a solution for this - by placing the code 'Application.Followhyperlink "C:\folder\docname.pdf" on the OnClick event...

thanks,
 

Users who are viewing this thread

Top Bottom