IMPORTING AND EXPORTING ACCESS OBJECTS TO HTML DOCUMENTS THE EASY WAY

As mentioned at the start of this chapter, HTML is a language used for creating Web pages used with the Internet and intranets. In Access, you can create HTML files from the various Access objects.

You can export objects in three ways—by exporting the document to an HTML, ASP, or IDC file type.

Using Export for Exporting to HTML

The most expedient way to export an object to HTML format is to highlight the object to export—in this case, the tblCustomers table—and then choose Export from the File menu. In the standard Export As dialog, select HTML Documents from the Save as Type drop-down list.

A couple of extra options become available when you choose HTML Documents (see Figure 19.14):

  • Save Formatted allows you to save the headings and table order into the HTML file.

  • Autostart starts Internet Explorer (IE) for you automatically, after exporting the object.

Figure 19.14. Get ready to save a table as an HTML document.


Check the Save Formatted and Autostart check boxes and then click Export. Access creates a datasheet type view when the HTML file (with an .htm extension) is viewed in page format. The next three figures show

  • The original table, tblCustomers, found in Chap19.mdb (see Figure 19.15).

    Figure 19.15. The original Access table to export.

  • The tblCustomers page view in IE (see Figure 19.16).

    Figure 19.16. When you export to HTML, Access fires off whatever Web browser you happen to be using—in this case, Microsoft's IE.

Note

Your .htm file is placed in your default folder and displayed in the address of the Web document.


  • The HTML source file. To get to this code while in IE, choose Source from the View menu. IE uses Notepad (or WordPad for larger files) to display the file (see Figure 19.17).

    Figure 19.17. This HTML source file for a Web document was created from Access data.

Note

When you use the Export command and change the file type to HTML Documents, you're creating a separate, static Web document.


You can retrieve information from an HTML file as well. Also remember that you can export other objects, such as reports, forms, and queries.

Importing and Linking to HTML Files

Access includes a new file type for importing and linking files. To link a file of the HTML type, follow these steps:

1.
From the main database window, choose Get External Data from the File menu, and then choose Link Tables. The Link dialog appears.

2.
From the Files of Type drop-down list, select HTML Documents (see Figure 19.18). Then choose the name of the .htm file to link to (in this case, tblCustomers) and click Link.

Figure 19.18. Access has added a new type of file to import and link.


This action starts the Link HTML Wizard. As with wizards that help you import and export file formats, the Link HTML Wizard walks you through linking to an HTML file. First, it displays the HTML file to be linked and asks whether the First Row Contains Column Headings (see Figure 19.19).

Figure 19.19. As with importing text files and spreadsheets, the Link HTML Wizard steps you through linking to an .htm file.


Note

The Advanced button in the bottom left corner of the dialog leads you to a link specification for the file. This is actually the same specification dialog used for importing and exporting files.


3.
Check that the first row does in fact contain column headings, as you can see in Figure 19.19. Then click Next.

4.
You're given the opportunity to change the Field Name and Data Type of each individual field. You can also specify whether to skip the field altogether, with the Do Not Import Field (Skip) check box (see Figure 19.20).

Figure 19.20. Through this dialog, you can set how each column should appear in Access, if at all.


5.
Click Next after you modify the fields. The last dialog of the HTML Link Wizard lets you name the link to the file anything you want. It uses the name part of the file as the default.

6.
Type 1 after the tblCustomers table name in the Link Table Name text box. Then click Finish. You get a message saying that the link was successful.

You then see the link listed in the current table listing with an Internet Explorer icon beside it. When you double-click the table, you see the recordset the table consists of.

Note

Linked HTML tables are static only. To update an HTML file, you need to import the table by following the steps just given but by choosing Import instead of Link Tables in step 1. Then update the data in the new table. Finally, use the Export command (discussed earlier in the section “Using Export for Exporting to HTML”) to re-create the .htm file.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.151.158