How do I create dyanmic hyperlinks in an Access report?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to take data values from query fields or expressions and use them to
generate URLs, e.g.
"http://somewhere.com/Products/" & [ProductName]
but all the hyperlink objects only seem to accept a static string, not a
dynamic expression.

Any suggestions, apart from writing raw html for the entire report including
headers & formatting?
 
The problems are that:
- Hyperlink object does not accept expressions in address or caption field -
only absolute strings
- There's no way to make a query calculated field have the data type of
Hyperlink: I've tried putting in "#" etc.

So in the end I had to write VB code to set the HyperlinkAddress property of
a Hyperlink object in my report, (URL_Hyperlink), using live values from
other query fields, ([ManualURL]). Pretty horrible, but it does work:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Not IsNull([ManualURL]) Then
URL_Hyperlink.HyperlinkAddress = [ManualURL]
URL_Hyperlink.Caption = [ManualURL]
End If
End Sub
 
Back
Top