Run a pdf as an Application through a Form - Possible? Urgent!!!

sonaljain123

Registered User.
Local time
Today, 04:20
Joined
Jul 6, 2011
Messages
68
Hi,

I have a main form like a main menu for the database as a form and I am trying to add a button in the same which can launch a pdf file stored at a location on my desktop.

Firstly is it possible to do this in MS Access?

Secondly, if yes, below is the code I am trying to work with, please let me know how I can modify the same to open this using a button:


Private Sub Command20_Click()
On Error GoTo Err_Command20_Click
Dim stAppName As String
stAppName = "K:\CLE03\M\UsersGuide.pdf"
Call Shell(stAppName, 1)
Exit_Command20_Click:
Exit Sub
Err_Command20_Click:
MsgBox Err.Description
Resume Exit_Command20_Click

End Sub

Thanks!
 
You can use the Follow Hyperlink to open the pdf:

Replace this line:
Call Shell(stAppName, 1)

With
FollowHyperlink stAppName
 
Hi,

I changed that to the following:

Private Sub Command39_Click()
On Error GoTo Err_Command39_Click
Dim stAppName As String
stAppName = "K:\CLE03\M\UsersGuide.pdf"
FollowHyperlink stAppName
Exit_Command39_Click:
Exit Sub
Err_Command39_Click:
MsgBox Err.Description
Resume Exit_Command39_Click
End Sub

But it still does not work, the error message it gave me was "cannot open to specified file"

Any other fix to this?

Thanks!
 
What version of Access? Could you try copying the pdf to your hd perhaps C:\Temp and see if that works?

FollowHyperlink "c:\temp\usersguide.pdf"

If that works, then there may be a network issue. You could also try UNC format rather than K:
 
Yes that does work perfectly....thank you...

are you familiar with writing macros in VB for MS access? I had a question on that too...
 

Users who are viewing this thread

Back
Top Bottom