Link between Access and a PDF file

nate0057

Registered User.
Local time
Today, 05:33
Joined
Oct 4, 2012
Messages
74
Hi there,

I have a database and I would like to link a PDF to the main interface of the database with a Help button.

Could you tell me how I can code that??


Thank you!
 
I use the FollowHyperlink method. It allows me to open a file of any type as long as it is registered and Windoes "knows" what program to execute to open it. So, sometimes the field referenced in this sub contains a .doc file name. Sometimes a .pdf and even occassionally a link to a web page.
Code:
Private Sub txtViewAuditDoc_Click()

On Error GoTo Proc_Err
    If Me.txtViewAuditDoc & "" = "" Then
        MsgBox "There is no document link.  Please add one on the Audit Parms form.", vbOKOnly + vbInformation
    Else
        Application.FollowHyperlink Me.txtViewAuditDoc, , True
    End If
Proc_Exit:
    Exit Sub
Proc_Err:
    Select Case Err.Number
        Case 7971
            Resume Proc_Exit
        Case Else
            MsgBox Err.Number & "--" & Err.Description, vbCritical
            Resume Proc_Exit
    End Select
End Sub
 
Last edited:
Hmm It's not exactly what I wanted Pat!! I just want that when I click and my button the pdf is directly open!!
I tried yours and it tell me 468: doesn't support it
 
I use the FollowHyperlink method. It allows me to open a file of any type as long as it is registered and Windoes "knows" what program to execute to open it. So, sometimes the field referenced in this sub contains a .doc file name. Sometimes a .pdf and even occassionally a link to a web page.
Code:
Private Sub txtViewAuditDoc_Click()

On Error GoTo Proc_Err
    If Me.txtViewAuditDoc & "" = "" Then
        MsgBox "There is no document link.  Please add one on the Audit Parms form.", vbOKOnly + vbInformation
    Else
        Application.FollowHyperlink Me.txtViewAuditDoc, , True
    End If
Proc_Exit:
    Exit Sub
Proc_Err:
    Select Case Err.Number
        Case 7971
            Resume Proc_Exit
        Case Else
            MsgBox Err.Number & "--" & Err.Description, vbCritical
            Resume Proc_Exit
    End Select
End Sub

I just want a simple code to do that :)
 
Ok I just succeed to do that! I use this code:

Code:
Private Sub Instructions_Click()

Shell "C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe S:\PRECIPART MASTER\Dan's CI Folder\Nathan's Files\project by master\User guide\PPAP's Program User Guide.pdf", vbNormalFocus


End Sub

Thanks
 
The code I posted does exactly what you need and is significantly more flexible than the code you settled on. Your code REQUIRES that the Adobe Reader version 9.0 be installed in the path you specified so your code will not work on any computer with a different version of Adobe and it will not work on your own computer if you upgrade the version. That is why I do NOT use the shell command to open external files. It requires that you know what software is required to open the file and exactly where it is installed. If you post your FollowHyperlink code that didn't work, we'll see if we can find the syntax error.
 

Users who are viewing this thread

Back
Top Bottom