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

command button hyperlink not working

Status
Not open for further replies.

Wrathchild

Technical User
Aug 24, 2001
303
US
Hi, I can't get a hyperlink on a command button to work. However, the same link works in the table I have tied to it and also if I use a text box it works fine. I'm assigning the link to the button thru code and when I hover over the button, it appears to be the right link, but will not work. I get the message Access can't follow the hyperlink...

I'm using A97
 
Wrath,

I use '97 and have a form with a command button, Command1:
Code:
   Private Sub Command1_Click()
   Dim strInput as String
       strInput = Text1
       Application.FollowHyperlink strInput, , False 
   End Sub

Is this similar to what you're working with?

John

Use what you have,
Learn what you can,
Create what you need.
 
Tried your method...no luck...looks like Access is adding a # to the beginning and end of the path...would that matter?
 
I have the path for the Word doc stored in a table example: \\Servername\central\Corporate\Worddoc.doc the file is stored on a server so there's no 'beginning' to the path. When the form is opened I have the path assigned to a text box and then using your method above I assigned the strInput to the text box. The weird thing is that it works fine using a text box...can't figure out why the command button is being stubborn! :)
 
Wrath,

Access uses the number sign (#) as a delimiter when storing
Hyperlinks. I'm guessing that presenting it in a text box negates the need for the delimiter.

Try declaring strInput as a variable to see if you can avoid adding a textbox. From the earlier example:
Code:
Private Sub Command1_Click()
   Dim strInput as String
       strInput =
DLookup("[HyperLinkField]", "TableName", "RecordID = " & Me.Form.RecordID)
Code:
       Application.FollowHyperlink strInput, , False 
   End Sub


Let me know if it works. John

Use what you have,
Learn what you can,
Create what you need.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top