ACC2002: How to Use Data Access Pages to Store and Display HTML Tags (304320)



The information in this article applies to:

  • Microsoft Access 2002

This article was previously published under Q304320
Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

SUMMARY

By using the Bound Span control on a data access page, you can store HTML tags in a field in a table, and then display the HTML on the page. This article shows you how to do this.

MORE INFORMATION

The following section shows you how to create a table with a field that contains the HTML tags. Then, it shows you how to create a data access page that has a Bound Span control to display the HTML.

Creating the Table

  1. Open the sample database Northwind.mdb.
  2. Create a new table as follows:
       Table: tblHtml
       ---------------------
       Field Name: ID
       Data Type: Autonumber
    
       Field Name: SomeHtml
       Data Type: Memo
    
       Table Properties: tblHtml
       -------------------------
       PrimaryKey: ID
    					
  3. Open the table in Datasheet view, and then type or paste the following data in the Somehtml field. Insert each line in a separate record.
    <H2>This is heading Level 2 in html</H2>
    <B>This is bold in Html</B>
    <H2>Table of Contents</H2> <OL> <BR> <LI>Introduction <LI>Company History <LI>Products offered</OL>
  4. Close the table.

Creating the Data Access Page

  1. Create a new page in Design view.
  2. In the field list, expand Tables, and then expand tblHtml.
  3. In the toolbox, click the Bound Span control.
  4. Drag the SomeHtml field from the field list to the page.
  5. Open the properties sheet for the Bound Span control, and then click the Data tab.
  6. Change the DataFormatAs property from Text to HTML.
  7. Open the data access page in Page view.

    Note that the Bound Span control recognizes the HTML tags from the table and displays them with the correct formatting.

Modification Type:MinorLast Reviewed:9/27/2006
Keywords:kbhowto KB304320