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!

HyperlinkAddress is Read only

Status
Not open for further replies.

jibberski

Programmer
Aug 24, 2005
52
US
I have a form that unhides controls and sets the caption for the label. Can I make a controls label a hyperlink?

Here's my error:
The HyperlinkAddress or HyperlinkSubAddress property is read-only for this hyperlink.
 
Perhaps the [blue]Follow Method[/blue] will do you well! Look it up in VBA help . . .

Calvin.gif
See Ya! . . . . . .
 
That happens because the label is associated to a control. Whenever that happens you can't set it as hyperlink or set its Click events, it forwards the events to the control is associated with.
Remove the association (Cut & Paste the label) and everything should work beautifully.
 
Thanks for all the help but I'm unable to break the connection between label and control to set the hyperlink property (it's read-only). I want the end user to be able to click the label of the control, popping up a help sheet for that input box.

Code:
Me("txtBox" & TextB).Visible = True
Me("txtBox" & TextB).Controls(0).Caption = rsVar!Variable
Me("txtBox" & TextB).Controls(0).Visible = True
Set ctl = Me("txtBox" & TextB)
Set ctlLabel = Me("txtBox" & TextB).Controls(0)
'ctlLabel.HyperlinkAddress = "http:\\ww.google.com"
Me("txtBox" & TextB).Value = GetAnswer(rsVar!Variable)
TextB = TextB + 1
 
There's no other way. You can't set the hyperlink as long as you don't remove the association.
You can change the code to adjust to that as long as you rename the label as lblBox1 for txtBox1 and make the code:
Code:
Me("txtBox" & TextB).Visible = True
Me("lblBox" & TextB).Caption = rsVar!Variable
Me("lblBox" & TextB).Visible = True
Set ctl = Me("txtBox" & TextB)
Set ctlLabel = Me("lblBox" & TextB)
ctlLabel.HyperlinkAddress = "http:\\ww.google.com"
Me("txtBox" & TextB).Value = GetAnswer(rsVar!Variable)
TextB = TextB + 1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top