The information in this article applies to:
SUMMARY
Advanced: Requires expert coding, interoperability, and multiuser skills.
NOTE: This article contains information about editing ASP files. It assumes that you are familiar with Active Server, Visual Basic Scripting, and editing HTML files. Microsoft Access Product Support professionals do not support modification of any HTML, HTX, IDC, or ASP files. MORE INFORMATIONEntering a Valid URL on the ASP Form Does Not Create a Valid HyperlinkIf you enter hyperlink data in your ASP form using the correct syntax for DisplayText, Address, and Subaddress, then Microsoft Access stores the data as a valid hyperlink in the Microsoft Access table, for example:Microsoft Home Page#http://www.microsoft.com#However, users who are familiar with entering hyperlink data in Microsoft Access will be accustomed to entering URLs in the format: http://www.microsoft.comThen Microsoft Access parses the data and creates the correct Hyperlink field. In the example in the "An Example That Works Around All Three Problems" section, you create VB Script with your ASP form that checks what the user types and adds the number signs and http:// if necessary to create a valid hyperlink in the Microsoft Access table. Hyperlink Fields on ASP Forms Are Not LiveThis behavior occurs because ASP forms you create with Microsoft Access 97 use the HTML Layout Control to display text boxes. You must write VB Script to get a Web browser to follow hyperlinks displayed in the text boxes; Microsoft Access 97 was not designed to create VB Script that achieves this functionality when it creates ASP forms. The example in the "An Example That Works Around All Three Problems" section walks you through creating the VB Script to parse the actual URL from the parts of the Hyperlink field, and then to set the window.location.href property to this URL in the MouseUp event of the text box that contains the hyperlink.Hyperlink Fields on ASP Forms Display Text Separated with Number Signs (#)In Microsoft Access 97, all Hyperlink fields consist of three distinct parts separated by number signs: DisplayText, Address, and Subaddress. The DisplayText is what you see in the table or form in your database; the Address and Subaddress information tells Microsoft Access what you want to view when you click the hyperlink. For example, the following hyperlink uses the first and second parts of the hyperlink field:Microsoft Home Page#http://www.microsoft.com#This hyperlink displays the text "Microsoft Home Page" in a Microsoft Access 97 table or form, and it opens http://www.microsoft.com when you click the link. The following example uses only one of the parts of the Hyperlink field: #http://www.microsoft.com/accessdev#In this case, the Microsoft Access 97 table or form displays http://www.microsoft.com/accessdev by default because there is no specific DisplayText portion of the hyperlink field; it also opens http://www.microsoft.com/accessdev when you click the link. An ASP form opened in your Web browser displays all three parts of the hyperlink information that is stored in your table, including the number signs. The example in the "An Example That Works Around All Three Problems" section shows you how to write VB Script that causes the Web browser to show only the DisplayText, or to show the Address and Subaddress if there is no DisplayText. The VB Script checks if a number sign (#) is the first character of the field's value. If so, then the Address and Subaddress is parsed and displayed on the ASP form. If not, then the Displaytext is parsed and displayed. An Example That Works Around All Three Problems
Modification #1: Saving a Valid Hyperlink in the Microsoft Access 97 TableNear the top of the Suppliersalx.asp file, you will see the following code:
Modify this function so it looks like the function below. The code checks to see if number signs are in the text that is entered in the hyperlink text box. If no number signs are entered, the function concatenates number signs before and after the text. The code also checks to see if http:// is entered, and adds it to the beginning of the URL if necessary. NOTE: If number signs are entered, the code does not check to see if http:// is entered. This allows a user to explicitly enter a URL that may, for example, point to an Office Object, which is a valid URL in Microsoft Access 97.
Modification #2: Making the Hyperlink LiveFurther down in the Suppliersalx.asp file, after the last Sub Procedure but before the --></SCRIPT> tag, add the following code. This code parses the Address portion of the Hyperlink field and saves it in a variable. The HomePage_MouseUp Sub Procedure executes when the hyperlink text box is clicked and causes the Web browser to navigate to the URL saved in the AddrPart variable.
Modification #3: Displaying the DisplayText or the Address and SubaddressIn the Suppliersalx.asp file, find the <OBJECT> tag for the HomePage text box. It will be beneath the last Sub Procedure you wrote. Look for the following code which sets the Value property for the text box:
Modify the code to match the code below. This code makes the text box in
the HTML Layout Control display the DisplayText portion of the hyperlink if
there is DisplayText. It will display the Address and Subaddress portion of
the hyperlink if there is no DisplayText:
Save and close the Suppliersalx.asp file.
Testing the ASP Form
REFERENCES
For more information about the parts of a Hyperlink field, search the Help
Index for "hyperlinks, returning hyperlink information."
Q163706 ASP Files Display Hyperlinks as Text in Web Browser Additional query words:
Keywords : kbinterop FmsOthr IntAsp |
Last Reviewed: November 2, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |