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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to open a field (hyperlinked), using a command button 1

Status
Not open for further replies.

greekpatriott

Technical User
Dec 15, 2004
65
0
0
CY
Hello,
I have a table as below. One of the fields has hyperlinks to a specific location.
If I have a form that shows all these data, how do I create a command button that will open the hyperlinked data? Thanks in advance.

Table
Index Description Location
1 Document1 C:\my document\doc1
2 Document2 C:\my document\doc2 3 Document3 C:\my document\doc3
 
Correction
It should show doc1.pdf, doc2.pdf, doc3.pdf. Cheers
 
Ok I found a solution through a thread from this site. There may be an easier way but this works though I have to write the document name in a new field, and to erase the hyperlink since it is not needed. Cheers

Code:
Private Sub Command17_Click()
   Dim WordPath As String, DocPath As String
   Dim FileName As String, FullSpec As String
   
   WordPath = "C:\Program Files\Adobe\Acrobat 6.0\Acrobat\acrobat.exe"
   DocPath = "C:\Documents and Settings\schristo\My Documents\Nemesis\SafetyPlans\Laws\"
   FileName = Forms!F_Search!DocName
   FullSpec = WordPath & " " & DocPath & FileName
   Shell FullSpec, vbMaximizedFocus
End Sub
 
You may try this:
Application.FollowHyperlink DocPath & FileName

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Code:
Private Sub Command21_Click()
Application.FollowHyperlink "C:\Documents and Settings\schristo\My Documents\Nemesis\SafetyPlans\Laws\" & Forms!F_Search!DocName
End Sub

This works too. Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top