Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open hyperlinks from form 1

Status
Not open for further replies.

BGuidry

Technical User
Mar 18, 2009
28
US
I am trying to have Access open PDF's via hyperlinks in a query, but from a command button on a form. It actually opens the correct record in datasheet view, and can then click the hyperlink to open in Acrobat, but get an error "Unable to open Query!qryLithLogLinks![Lith_Logs]. Cannot open the specified file". I have enabled these references: Adobe Acrobat 8.0 Type Library, Acrobat Access 3.0 Type Library, Adobe Acrobat 8.0 Browser Control Type Library 1.0. What I would really prefer it do is open either a folder (from hyperlink path in query) or PDF (with default application), as some of the records may or may not not have an associated PDF.

Code:

Private Sub Command59_Click()
Dim ObjPdfApp As Object
Set ObjPdfApp = CreateObject("AcroExch.App")
DoCmd.OpenQuery ("qryLithLogLinks")
End Sub
 
I use the follow method of a variable typed as hyerlink to do this... You just need to set the variable equal to something in my example below.

Code:
Dim x As Hyperlink
x = <Your Code here>
x.Follow True
 
This should help.
Code:
Dim strLink As String

strLink = "[URL unfurl="true"]http://www.freedb.org"[/URL]

FollowHyperlink strLink, , False

Ian Mayor (UK)
Program Error
9 times out of 10 I know what I'm talking about. This must be my tenth reply.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top