Hyperlink Text to Display

G

Guest

I added a combo box with values that I would like to pick up in the Hyperlink
TextToDisplay of a hyperlink field.

In the After Update event of the combo box, I added:
Me.(myfield).SetFocus
RunCommand accmdInsertHyperlink

What is the command to then pick up the combo box value in the Text to
Display? I tried adding line:
Me.(myfield).Hyperlink.Texttodisplay = Me.(combobox)

I get an error: Run-Time Error 7980
The HyperlinkAddress or HyperlinkSubAddress property is read-only for this
hyperlink.
 
J

John Nurick

Hi Bernie,

Don't bother with DoCmd.InsertHyperlink. Instead, open a table that has
a hyperlink field in it, tab into the hyperlink field, and hit F2.
You'll see the actual contents of the field, which may be just the
address, e.g. http://www.microsoft.com, or display text and address
separated by #, e.g.
MSFT#http://www.microsoft.com
plus maybe a sub-address separated by another #.

What you need to do is to build similar strings. So you might do
something like

Dim strURL As String

strURL = "http://www.microsoft.com" 'or get the address
'some other way

Me.MyField.Value = strURL & "#" & Me.Combobox.Value
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top