[ Team LiB ] Previous Section Next Section

Saving Database Objects as HTML

Probably one of the most basic but powerful features in Access is the capability to save database objects as HTML documents. You can publish table data, query results, form datasheets, forms, and reports as HTML. Each of these objects is covered in the sections that follow.

Saving Table Data as HTML

When saving table data, you can store it in the HTML file format so that you can easily publish it on the Web. To save table data as HTML, just follow these steps:

  1. Click Tables in the Objects list of the Database window.

  2. Select the table whose data you want to save as HTML.

  3. Choose File | Export to open the Export Table dialog box.

  4. From the Save As Type drop-down list, select HTML Documents.

  5. Select a filename and a location for the HTML document.

  6. Click Export to finish the process.

Access exports the file to HTML so that you can view it from any Web browser (see Figure 19.1). You can also view the HTML source, as shown in Figure 19.2. To view the HTML file in a browser, you simply locate the file on your hard disk in Explorer or My Computer and double-click the file. The file then launches in Internet Explorer (or your default browser). To view the source, you select View | Source while in Internet Explorer.

Figure 19.1. The Northwind database Customers table saved as HTML.

graphics/19fig01.jpg

Figure 19.2. The source of the Northwind database Customers table's HMTL file.

graphics/19fig02.jpg

Saving Query Results as HTML

The capability to save query results as HTML means you don't need to save all fields and all records to an HTML file. In fact, you can even save the results of Totals queries and other complex queries as HTML. Saving the result of a query as HTML is similar to saving a table as HTML. It involves these steps:

  1. Click Queries in the Objects list of the Database window.

  2. Select the query whose results you want to save as HTML.

  3. Choose File | Export to open the Export Query dialog box.

  4. From the Save As Type drop-down list, select HTML Documents.

  5. Select a filename and a location for the HTML document.

  6. Click Export to finish the process. Access exports the file to HTML so that you can view it from any Web browser.

Saving Forms as HTML

You can't save an entire form as HTML, but you can save a form's datasheet as HTML because an HTML file is a static file. It doesn't change as the data in the database changes, nor can you modify the data in an HTML file. To save a form's datasheet as HTML, follow these steps:

  1. Click Forms in the Objects list of the Database window.

  2. Select the form whose results you want to save as HTML.

  3. Choose File | Export to open the Export Form dialog box.

  4. From the Save As Type drop-down list, select HTML Documents.

  5. Select a filename and a location for the HTML document.

  6. Click Export. The HTML Output Options dialog box, shown in Figure 19.3, appears.

    Figure 19.3. The HTML Output Options dialog box, which allows you to select an HTML template and the encoding you want Access to apply when exporting the form.

    graphics/19fig03.jpg

  7. Select an optional HTML template for Access to apply to the HTML document. By selecting an HTML template, you can easily maintain a consistent look for your Web publications. Select the type of encoding that you want to use. Depending on the language you are using, you might need to select Unicode or Unicode (UTF-8) encoding. Click OK. Access exports the form's datasheet to HTML. If you selected the Autostart option, the browser launches. Otherwise, you are returned to the Database window.

Saving Reports as HTML

You can save reports and their formatting as HTML, and this is an elegant way to publish data on an Internet or intranet site. To publish a report as HTML, just follow these steps:

  1. Click Reports in the Objects list of the Database window.

  2. Select the report whose results you want to save as HTML.

  3. Choose File | Export to open the Save As dialog box.

  4. From the Save As Type drop-down list, select HTML Documents.

  5. Select a filename and a location for the HTML document.

  6. Click Export. The HTML Output Options dialog box appears.

  7. Select an optional HTML template for Access to apply to the HTML document. Select the type of encoding you want to use and click OK. Access exports the report to HTML. If you selected the Autostart option, the browser launches. Otherwise, you are returned to the Database window.

Figure 19.4 shows a report published as HTML. Because the report is a multipage report, Access generates several HTML files. The generated HTML links each page of the report, and the user can easily navigate from page to page by using the First, Previous, Next, and Last hyperlinks that are automatically generated during the Save process.

Figure 19.4. Viewing the Northwind database Alphabetical List of Products report as HTML.

graphics/19fig04.jpg

    [ Team LiB ] Previous Section Next Section