Microsoft KB Archive/165295

= ACC97: Can't Create Valid Links in Hyperlink Field on ASP Form =

Article ID: 165295

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q165295



Novice: Requires knowledge of the user interface on single-user computers.



SYMPTOMS
When you use Microsoft Access 97 to create an Active Server Pages (ASP) form, and you use that form to add or modify data in a Hyperlink field, the record in the table does not contain a valid hyperlink.



CAUSE
ASP forms do not contain the built-in functionality to add Hyperlink fields.



RESOLUTION
You can edit the Hyperlink field in the Microsoft Access table to provide the missing information, or you can enter the Hyperlink field on the ASP form in a way that Microsoft Access understands and translates to hyperlink data.

NOTE: Both of the following methods create a valid hyperlink in the Microsoft Access table, but not on the ASP form itself. You cannot follow hyperlinks displayed in a text box on an ASP form.

Editing the Record in the Table

 * 1) After you add a new record using the ASP form, start Microsoft Access and open the database in which the table resides.
 * 2) Locate the newly added record.
 * 3) Using the right mouse button (right-click), click the Hyperlink field in the record.
 * 4) On the shortcut menu that appears, point to Hyperlink, and then click Edit Hyperlink.
 * 5) In the Insert Hyperlink dialog box, fill in the missing information in the "Link to file or URL" box and the "Named location in file" box. Click OK.

Entering the Record as a Hyperlink on the ASP Form
When you add or modify a record using the ASP form, you can type the hyperlink information in a way that enables Microsoft Access to create a valid Hyperlink field in the table.

All Hyperlink fields consist of three separate parts, separated by number signs: DisplayText, Address, and Subaddress. The DisplayText is what you see in the table or on the form; the address and subaddress information tells Microsoft Access what you want to view when you click the hyperlink. For example, the following hyperlink uses all three parts of the hyperlink field:

  1997 Sales Figures#C:\My Documents\Sales.ppt#24

In this example, 1997 Sales Figures is what a user sees in the hyperlink field, C:\My Documents\Sales.ppt is the name of the Microsoft PowerPoint slide that opens when you click the link, and 24 is the slide number that is displayed.

The next examples use only two of the three parts in the Hyperlink field:

Microsoft Home Page#http://www.microsoft.com#

Quarterly Orders Form##Form Quarterly Orders

The first hyperlink displays the text "Microsoft Home Page" and opens http://www.microsoft.com when you click the link. The second hyperlink displays the text "Quarterly Orders Form" and opens the Quarterly Orders form in the current database when you click it.

Finally, this example uses only one of the parts of the Hyperlink field:


 * 1) http://www.microsoft.com/accessdev#

In this case, Microsoft Access displays http://www.microsoft.com/accessdev by default because there is no specific display text, and it also opens http://www.microsoft.com/accessdev when you click it.

If 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.



STATUS
This behavior is by design.



Steps to Reproduce Behavior
CAUTION: Following the steps in this example will modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and perform these steps on a copy of the database.

 Start Microsoft Access and open the sample database Northwind.mdb. Select the Suppliers table in the Database window. On the File menu, click Save As/Export. In the Save As dialog box, click "To an External File or Database," and then click OK.</li> In the "Save Form 'Suppliers' In" dialog box, select Microsoft Active Server Pages (*.asp) in the Save As Type box, and save the Suppliers.asp file in a folder on your Web server where you have Execute permission. Click Export.</li> In the Microsoft Active Server Pages Output Options dialog box, type a valid System DSN on your Web server in the Data Source Name box, and type the uniform resource locator (URL) on your server where the ASP file will be located in the Server URL box. Click OK.</li> Start Microsoft Internet Explorer 3.0, or another Web browser program.</li> Type the URL in the address box of your Web browser to view Suppliers.asp, for example http://MyServer/Aspsamp/Suppliers.asp. Note that the URL depends upon where your files are located on the Web server computer.</li> The Suppliers form opens in your Web browser and displays the first record in the Suppliers table.</li> Click in the Home Page field of the first record and enter the following data:

http://www.microsoft.com

</li> Click the Commit button at the bottom of the form to save the record.</li> In Microsoft Access, open the Suppliers table in Datasheet view.</li> Locate the Supplier record you just changed (probably Exotic Liquids) and click in the Home Page Hyperlink field. Note that nothing happens.

If you repeat steps 7-13, but you enter the following data in step 10, the hyperlink will work properly in Microsoft Access:

Microsoft Home Page#http://www.microsoft.com#

</li></ol>

<div class="references_section">