Automaticly creating a hyperlink

G

Guest

I have created code to automaticly create a hyperlink address base on user
input from a click of a command button. We are linking to pdf file on our
server to a field in a table. Each pdf has a unique name that is associated
to field in a table. That field is set to hyperlink. However I get an
"run-time error '7980' THe Hyperlink Address or SubAddress property is read
only for this hyperlink". What am I missing?


Dim lCallID, lHyper, lLinkAdd As String

Public Sub GenHyper()

Dim lCall, lLink, lExt As String
Dim dNum As Single

lCall = CallSign
lLink = "License\!Site&LicenseDatabase\"
lExt = ".pdf"
lCallID = lLink + lCall + lExt
lHyper = lCallID
lLinkAdd = lCallID
Lookup.IsHyperlink = True
Lookup.Hyperlink.Address = lLinkAdd
Lookup.Hyperlink.TextToDisplay = lHyper
End Sub

Private Sub Command60_Click()
Lookup.SetFocus
If Lookup.Text = "" Then
Call GenHyper
End If
Lookup.Hyperlink.Address = lLinkAdd

End Sub
 
G

Guest

Tim,

See the post entitled "Hyperlink and column lookup" by in Forms. I was
getting the same run-time error you were just yesterday, and just fixed it
today. I was building a hyperlink address to PDF files on the fly (based on
the application and PDFs location path). You have to assign the hyperlink
properties to a label, not a text field. I just put my hyperlink string into
a variable and assigned the 3 hyperlink properties (address, subaddress and
label) to that variable and it worked beautifully! Hope this helps.

Michele
 

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