Application.HyperlinkPart (Access)
The HyperlinkPart method returns information about data stored as a Hyperlink data type.
You use the HyperlinkPart method to return one of three values from a Hyperlink field or the displayed value. The value returned depends on the setting of the part argument. The part argument is optional. If it's not used, the function returns the value Microsoft Access displays for the hyperlink (which corresponds to the acDisplayedValue setting for the part argument). The returned values can be one of the four parts of the Hyperlink field (displaytext, address, subaddress, or screentip), the full address, address# subaddress, or the value Microsoft Access displays for the hyperlink.
HyperlinkPart (Hyperlink, Part)
DisplayHyperlinkParts "MyHyperlinkTableName", "MyHyperlinkFieldName"
Public Sub DisplayHyperlinkParts(ByVal strTable As String, _
ByVal strField As String)
Dim rst As New ADODB.Recordset
Dim strMsg As String
rst.Open strTable, CurrentProject.Connection, _
adOpenForwardOnly, adLockReadOnly
' For each record in table.
Do Until rst.EOF
strMsg = "DisplayValue = " _
& HyperlinkPart(rst(strField), acDisplayedValue) _
& vbCrLf & "DisplayText = " _
& HyperlinkPart(rst(strField), acDisplayText) _
& vbCrLf & "Address = " _
& HyperlinkPart(rst(strField), acAddress) _
& vbCrLf & "SubAddress = " _
& HyperlinkPart(rst(strField), acSubAddress) _
& vbCrLf & "ScreenTip = " _
& HyperlinkPart(rst(strField), acScreenTip) _
& vbCrLf & "Full Address = " _
& HyperlinkPart(rst(strField), acFullAddress)
' Show parts returned by HyperlinkPart function.
MsgBox strMsg
rst.MoveNext
Loop
End Sub
Arguments
The following argument is required
Hyperlink (Hyperlink) - The data stored in a Hyperlink field.
Optional arguments
The following argument is optional
Part (AcHyperlinkPart) - An AcHyperlinkPart constant representing the information that you want returned by the HyperlinkPart method.
Possible values are
acAddress | The address part of a Hyperlink field. |
acDisplayedValue | The underlined text displayed in a hyperlink. |
acDisplayText | The displaytext part of a Hyperlink field. |
acFullAddress | The address and subaddress parts of a Hyperlink field, delimited by a "#" character. |
acScreenTip | The tooltip part of a Hyperlink field. |
acSubAddress | The subaddress part of a Hyperlink field. |