Reading a hyperlink from a table and inserting it into the hyperlink property...

  • Thread starter Thread starter MaxGay
  • Start date Start date
M

MaxGay

I would like to know how to read a hyperlink from a table and then in turn
insert that hyperlink into the hyperlink property of a command button to
execute it.

My database has serveral hyperlinks stored in the fields of a table.

Thank you in advance

Max
 
strHyperlink = HyperlinkPart(Trim(Nz(Me!lnkDescription.Value, "")),
acAddress)
strLinkName = HyperlinkPart(Trim(Nz(Me!lnkDescription.Value, "")),
acDisplayText)
int_PPT_Pg_Nbr = HyperlinkPart(Trim(Nz(Me!lnkDescription.Value, "")),
acSubAddress)
str_ToolTip_PPT = HyperlinkPart(Trim(Nz(Me!lnkDescription.Value, "")),
acScreenTip)

Me.control.Visible = True
Me.control.HyperlinkAddress = strHyperlink
Me.control.HyperlinkSubAddress = Trim(str(int_PPT_Pg_Nbr))
Me.control.Caption = str_ToolTip_PPT

Hyperlinks are text strings with four parts delimited by "#"
display text#web or lan address#sub address#tooltip
Sub address depends on the target. PowerPoint is a page number.
Excel is a range name.
etc.
 
Max,

I find it easiest to just use the application.followhyperlink method. In
the Click event of the command button, retrieve the hyperlink address (file
name or url)

Private sub cmd_Open_Hyperlink_Click

Dim strHyperlink as string
strHyperlink = dlookup("HyperlinkAddress", "yourTable", "ID = " & me.ID)

'there are a couple of other parameters available for this method but this
'is the easiest method
application.followhyperlink (strHyperlink)

End Sub

HTH
Dale
 
Back
Top