ACC97: ASP Files Display Hyperlinks as Text in Web BrowserID: Q163706
|
Moderate: Requires basic macro, coding, and interoperability skills.
Hyperlink fields in an Active Server Pages (ASP) file created with
Microsoft Access 97 are displayed as text with number signs (#) when
you view them with a Web browser.
Data that is stored in a Microsoft Access hyperlink field is stored in three parts (displaytext, address, and subaddress) separated by number signs. This is different from hyperlinks in HTML files, which are created using the <A> tag. Microsoft Access outputs the data in a hyperlink field as it exists, without adding the <A> tags or parsing the data into an HTML format.
Create a select query that parses the hyperlink field and adds the
appropriate <A> tags. Then export the query to an ASP file, and modify the
file so the hyperlink field is not HTML encoded.
If you do not modify the ASP file, the < and > symbols are translated to
< and > respectively, and the hyperlink is still displayed as text.
NOTE: If you create form based on the query and export it to ASP format,
the hyperlinks are not preserved. This method does not work with Microsoft
Access forms exported to ASP format.
The following example demonstrates how to create a select query that you
can export to ASP format so the hyperlink fields are preserved when you
view them in a Web browser. The query contains a column that parses the
HomePage Hyperlink field in Northwind's Suppliers table, and adds HTML
tags to preserve the links.
NOTE: This example contains information about editing ASP files. It
assumes that you are familiar with Active Server, Visual Basic Scripting,
and editing HTML files. Microsoft Product Support professionals do not
support modification of any HTML, HTX, IDC, or ASP files.
Query: HyperASP
------------------------------------------------------------------
Type: Select Query
Field: SupplierID
Table: Suppliers
Field: GoodHyper: "<A HREF=""" & Right([HomePage],Len(IIf(IsNull _
([HomePage]),"",[HomePage]))-InStr(IIf(IsNull([HomePage]), _
"",[HomePage]),"#")) & """>" & IIf(Left([HomePage], _
IIf(InStr(IIf(IsNull([HomePage]),"",[HomePage]),"#")>1, _
InStr(IIf(IsNull([HomePage]),"",[HomePage]),"#")-1,0))="", _
[HomePage],Left([HomePage],IIf(InStr(IIf(IsNull _
([HomePage]), "",[HomePage]),"#")>1,InStr(IIf(IsNull _
([HomePage]),"",[HomePage]),"#")-1,0))) & "</A>"
The expression in the GoodHyper column is so long because it must
account for nulls in the hyperlink field, and the NZ function cannot
be used with ASP. The expression must also handle hyperlinks that do
not contain the displaytext portion of the hyperlink field.
Q159682 ACC97: "Data Source Name Not Found" Err Msg Opening Web Page
COLOR=#000000><%=Server.HTMLEncode(rs.Fields("GoodHyper").Value)%>
<BR></FONT></TD>
Remove the Server.HTMLEncode portion of the text so it looks like
this:
COLOR=#000000><%=rs.Fields("GoodHyper").Value%><BR></FONT></TD>
Q162975 ACC97: Permissions Necessary to View HTML, IDC, and ASP Files
http://<servername>/test/Suppliers.aspNote that the URL depends upon where your files are located on the Web Server.
For more information about exporting ASP files, search the Help Index for "ASP files," or ask the Microsoft Access 97 Office Assistant.
Additional query words: IIS 3.0 PWS Personal Web Server Peer Services
Keywords : kbinterop IntPubWiz IntAsp
Version : WINDOWS:97; winnt:3.0
Platform : WINDOWS winnt
Issue type : kbprb
Last Reviewed: July 8, 1999