Part III: More-Advanced Access Techniques
594
As with so many other things in database development, many decisions involved in linking to
external data sources are based on how the data is to be used in the application. Also, the names
you provide for fields and other details have a direct impact on your application.
Linking to HTML files
Linking to data contained in HTML documents is not covered in detail in this book because of the
rather severe limitations imposed by Access on this process. For example, Access is unable to
retrieve data from an arbitrary HTML file. The data must be presented as an HTML table, in a row-
and-column format, and the data has to be relatively clean (absent any unusual data or mix of data,
such as text, image, and numeric data combined within a single HTML table).
You’re likely to encounter problems if more than one HTML table appears on the page, or if the
data is presented in a hierarchical fashion (parent and child data).
Tip
All things considered, linking to arbitrary HTML documents is hit-or-miss at best. You’re much better off link-
ing to an HTML document specifically prepared as a data source for your Access application than trying to
work with arbitrary HTML files.
Plus, if someone is going to the trouble of creating specialized HTML documents to be used as
Access data sources, producing comma-separated values (CSV) or fixed-width text files is probably
a better choice than HTML. Comma-separated values, where the fields in each row are separated
by commas, is a very common way to move data from one application to another. CSV and fixed-
width file types are discussed in the next section.
Having said that, the process of linking HTML data is very similar to linking to Excel spreadsheets:
- Select the More drop-down list in the External Data tab and select HTML Document from
the list.
The Get External Data dialog box appears.
- Select the Link to the Data Source by Creating a Link Table option, and click Browse.
The File Open dialog box appears, enabling you to search for the HTML file you want to link.
From this point on, the process of linking to HTML data is similar to linking to other
types of data files, including providing field names and other details of the linked data.
Figure 16.9 shows the first screen of the Import HTML Wizard. Click the Advanced but-
ton in the lower-left hand corner to get to the Import Specification screen (shown in
Figure 16.10), where you can provide the field names and other details.
On the CD-ROM
This book’s CD includes a very simple HTML file named CustomerTypes.html. The data in this file is, per-
haps, overly simplistic, but it gives you the opportunity to practice linking to HTML documents. Because of the
wide variety of ways that data is stored in HTML documents, it isn’t possible to generalize an approach to link-
ing to HTML data. However, as you gain proficiency with the ability to link to external data sources, you might
find linking to HTML a valuable addition to your Access skills.