By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,649 Members | 1,808 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,649 IT Pros & Developers. It's quick & easy.

Error 7980: HyperlinkAddress or HyperlinkSubAddress read-only for Hyperlink

NeoPa
Expert Mod 15k+
P: 31,261
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
Expand|Select|Wrap|Line Numbers
  1. Field   Type        Index
  2. LinkID  Autonumber  PK
  3. 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
Expand|Select|Wrap|Line Numbers
  1. Control         Type    Bound
  2. txtLinkID       TextBox   Y
  3. txtDescription  TextBox
  4. txtHTTP         TextBox
  5. 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) :
Expand|Select|Wrap|Line Numbers
  1. Private Sub txtDescription_AfterUpdate()
  2.     Call UpdateLink
  3. End Sub
  4.  
  5. Private Sub txtHTTP_AfterUpdate()
  6.     Call UpdateLink
  7. End Sub
  8.  
  9. Private Sub UpdateLink()
  10.     With Me.txtLink
  11.         .Locked = False
  12.         .Value = Me.txtDescription
  13.         .Hyperlink.Address = Me.txtHTTP
  14.         .Locked = True
  15.     End With
  16. 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.
Oct 10 '09 #1

✓ answered by NeoPa

Although this particular problem is still confusing me, I did eventually find (by looking differently) something that helped me to do what I needed without accessing the .Hyperlink property directly.

The page I found (Introduction to Hyperlink fields) was from Allen Browne's site. The concept is simply to set the .Value of the TextBox to a three way string comprising Description#Link#Sublink (Sublink optional).

My final code is :
Expand|Select|Wrap|Line Numbers
  1. Private Sub UpdateLink()
  2.     With Me
  3.         .txtLink.Locked = False
  4.         '+ used with strings resolves to Null if any element is Null.
  5.         Select Case "" + .txtDescription + .txtHTTP
  6.         Case Null
  7.             .txtLink = .txtDescription & .txtHTTP
  8.         Case Else
  9.             .txtLink = .txtDescription & "#" & Me.txtHTTP & "#"
  10.         End Select
  11.         .txtLink.Locked = True
  12.     End With
  13. End Sub
The best part of it all is - It works!

Share this Question
Share on Google+
1 Reply


NeoPa
Expert Mod 15k+
P: 31,261
Although this particular problem is still confusing me, I did eventually find (by looking differently) something that helped me to do what I needed without accessing the .Hyperlink property directly.

The page I found (Introduction to Hyperlink fields) was from Allen Browne's site. The concept is simply to set the .Value of the TextBox to a three way string comprising Description#Link#Sublink (Sublink optional).

My final code is :
Expand|Select|Wrap|Line Numbers
  1. Private Sub UpdateLink()
  2.     With Me
  3.         .txtLink.Locked = False
  4.         '+ used with strings resolves to Null if any element is Null.
  5.         Select Case "" + .txtDescription + .txtHTTP
  6.         Case Null
  7.             .txtLink = .txtDescription & .txtHTTP
  8.         Case Else
  9.             .txtLink = .txtDescription & "#" & Me.txtHTTP & "#"
  10.         End Select
  11.         .txtLink.Locked = True
  12.     End With
  13. End Sub
The best part of it all is - It works!
Oct 10 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.