[AccessD] Hyperlink in Access

MartyConnelly martyconnelly at shaw.ca
Tue Sep 13 11:09:08 CDT 2005


Use the hyperlinkpart function, it is called without access constants in SQL
 From the old Access97 help file
HyperlinkPart Function Example

The following example uses all four of the part argument constants to 
display information returned by the HyperlinkPart function for each 
record in a table containing a Hyperlink field. To try this example, 
paste the DisplayHyperlinkParts procedure into the Declarations section 
of a module. You can call the DisplayHyperlinkParts procedure from the 
Debug window, passing to it the name of a table containing hyperlinks 
and the name of the field containing Hyperlink data. For example:

DisplayHyperlinkParts "MyHyperlinkTableName", "MyHyperlinkFieldName"

Sub DisplayHyperlinkParts(strTable As String, strField As String)
    Dim dbs As Database, rst As Recordset
    Dim strMsg As String

    Set dbs = CurrentDb
    Set rst = dbs.OpenRecordset(strTable)

    While Not rst.EOF        ' For each record in table.
        strMsg = "DisplayValue = " & HyperlinkPart(rst(strField), 
acDisplayedValue) _
            & vbCrLf & "DisplayText = " & HyperlinkPart(rst(strField), 
acDisplayText) _

            & vbCrLf & "Address = " & HyperlinkPart(rst(strField), 
acAddress) _
            & vbCrLf & "SubAddress = " & HyperlinkPart(rst(strField), 
acSubAddress)
        ' Show parts returned by HyperlinkPart function.
        MsgBox strMsg
        rst.MoveNext
    Wend
End Sub



When you use the HyperlinkPart function in a query, the part argument is 
required. For example, the following SQL statement uses the 
HyperlinkPart function to return information about data stored as a 
Hyperlink data type in the URL field of the Links table:

SELECT Links.URL, HyperlinkPart([URL],0)
AS Display, HyperlinkPart([URL],1)
AS Name, HyperlinkPart([URL],2)
AS Addr, HyperlinkPart([URL],3) AS SubAddr
FROM Links;





Julie Reardon-Taylor wrote:

>Hi List,
>
>I have a different kind of question.  I'm using an Address Block for a 
>snaking report.  Within the "members" table, I have a field for Website 
>Address formatted as a hyperlink.  When the field shows up on the report, it 
>looks like this:  www.businessname.com #http://www.businessname.com#
>
>This is obviously because of the hyperlink.  Is there a way to format that 
>field so that the http portion does not show up, yet still maintain the 
>hyperlink in the table?
>
>The users like the hyperlink, because all they have to do is click on the 
>web address and the hyperlink takes the user right to the members website, 
>so I would hate to get rid of it.
>
>Any ideas?
>
>
>
>
>
>Julie Reardon-Taylor
>PRO-SOFT OF NY, INC.
>44 Public Square Suite #5
>Watertown, NY 13601
>Phone/Fax: (315) 785-0319
>www.pro-soft.net
>
>
>  
>

-- 
Marty Connelly
Victoria, B.C.
Canada






More information about the AccessD mailing list