Importing Information from an HTML File


You might be familiar with Hypertext Markup Language (HTML), which is used to create Web pages. HTML uses tags to control the appearance and alignment of text when it is displayed in a Web browser. To display a table on a Web page, the table's elementsrows and cellsare enclosed in appropriate HTML tags. For example, a simple HTML table might look like this:

. . . <table> <tr>    <td>LastName</td><td>FirstName</td> </tr>    <td>Anderson</td><td>Nancy</td> </tr> </table> . . .


Of course, a lot of other tags and text would appear above and below the table, and few tables are this simple, but the example conveys the general idea. With an HTML document, it is the <table>, <tr> (table row), and <td> (table data) tags that make the data look like a table when viewed in a Web browser.

All the 2007 Office programs can save a document in HTML format, and to a limited extent, they can read or import a document that was saved in HTML format by another program. If you attempt to import an HTML document into Access, it will parse the document and identify anything that looks like structured data. You can then look at what Access has found and decide whether to import it.

Important

If you want to import data into an existing table but the data structure isn't the same as the table structure, it is often easier to import the data into Excel, manipulate it there, and then import it into Access.


In this exercise, you will import information from an HTML document into an existing table in an Access database.

USE the 07_ImportHTML database and the 07_NewCust HTML file. These practice files are located in the Chapter03 subfolder under SBS_Access2007.

OPEN the 07_ImportHTML database.


1.

Open the Customers table, and notice that it contains 107 records. Then close the table.

2.

On the External Data tab, in the Import group, click the More button, and then in the list, click HTML Document.

The Get External Data wizard starts.

3.

On the Select the source and destination of the data page, click the Browse button.

4.

In the File Open dialog box, navigate to your Documents\MSP\SBS_Access2007\Chapter03 folder, click the 07_NewCust HTML file, and then click Open.

5.

Select the Append a copy of the records to the table option, click Customers in the list, and then click OK.

The Import HTML wizard starts.

The wizard displays the contents of the 07_NewCust file, divided into rows and columns. If a file contains multiple tables or lists, the wizard shows them here, and you can select the one you want to import.

6.

Select the First Row Contains Column Headings check box, and then click Finish.

Access imports the information into the Customers table.

Tip

You can click an active Finish button in a wizard at any time to accept the default setting for the remaining wizard pages.

7.

On the Save Import Steps page, click Close.

8.

Open the Customers table to verify that it contains 110 records (the original records plus three imported from the HTML file).

CLOSE the 07_ImportHTML database.




MicrosoftR Office AccessT 2007 Step by Step
MicrosoftR Office AccessT 2007 Step by Step
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 127

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net