Error 7980: The HyperlinkAddress or HyperlinkSubAddress property is read-only for this hyperlink
I'm struggling with some code to update Hyperlinks in my table. The field is defined as a Hyperlink and is editable without problem from the interface (I open the table for display, right-click on an item and select
Hyperlink /
Edit Hyperlink and all is fine).
The table is defined very simply as :
Table = tblLink - Field Type Index
-
LinkID Autonumber PK
-
Link Hyperlink
I run into problems however, when I try to update (or even add a new one from scratch) this item on my form. The form is laid out as :
Form = tblLinkEdit - Control Type Bound
-
txtLinkID TextBox Y
-
txtDescription TextBox
-
txtHTTP TextBox
-
txtLink TextBox Y
The operator fills in both of the unbound TextBoxes, then the code should create a Hyperlink in
txtLink from what's entered.
The code for the update (AfterUpdate of both of the unbound TextBoxes) is as follows (
txtLink is designed as locked so no-one tries to edit it in place) :
- Private Sub txtDescription_AfterUpdate()
-
Call UpdateLink
-
End Sub
-
-
Private Sub txtHTTP_AfterUpdate()
-
Call UpdateLink
-
End Sub
-
-
Private Sub UpdateLink()
-
With Me.txtLink
-
.Locked = False
-
.Value = Me.txtDescription
-
.Hyperlink.Address = Me.txtHTTP
-
.Locked = True
-
End With
-
End Sub
I've tried various other ways of approaching this problem but as none of them has shown any success, I won't bore you with the details. Suffice to say I tried editing the existing Hyperlink as well as attempting to build it from scratch as in this code.
When it gets to line #13 the error message of the title pops up :
Error 7980: The HyperlinkAddress or HyperlinkSubAddress property is read-only for this hyperlink
NB. I find it particularly confusing as the property I'm attempting to assign is neither of those of course.
I'd be grateful for any sort of assistance. If anyone can simply point me to where to look that would be fine.