Hyperlink troubles

J

Joel

Morning everyone,
I am having troubles getting a hyperlink textbox to work on my form.
The address shows up like a hyperlink (blue and underlined) but when I click
on it, it does nothing.
For Testing purpouses I used www.yahoo.com as the address.

You dont have to use vb code to have it open IE do you?

Thanks
Joel
 
X

xRoachx

Hey Joel, try listing the full address:

http://www.yahoo.com/

This worked for me when the control was a label. If the control is a
textbox or button, you need to set the address through code. I pulled this
example from the help file:

Example
The CreateHyperlink procedure in the following example sets the hyperlink
properties for a command button, label, or image control to the address and
subaddress values passed to the procedure. The address setting is an optional
argument, because a hyperlink to an object in the current database uses only
the subaddress setting, To try this example, create a form with two text box
controls (txtAddress and txtSubAddress) and a command button (cmdFollowLink)
and paste the following into the Declarations section of the form's module:

Private Sub cmdFollowLink_Click()
CreateHyperlink Me!cmdFollowLink, Me!txtSubAddress, _
Me!txtAddress
End Sub

Sub CreateHyperlink(ctlSelected As Control, _
strSubAddress As String, Optional strAddress As String)
Dim hlk As Hyperlink
Select Case ctlSelected.ControlType
Case acLabel, acImage, acCommandButton
Set hlk = ctlSelected.Hyperlink
With hlk
If Not IsMissing(strAddress) Then
.Address = strAddress
Else
.Address = ""
End If
.SubAddress = strSubAddress
.Follow
.Address = ""
.SubAddress = ""
End With
Case Else
MsgBox "The control '" & ctlSelected.Name _
& "' does not support hyperlinks."
End Select
End Sub
 
Top