Linking Tables from External Sources

In addition to the native Microsoft Jet database format (.mdb), Microsoft Jet allows you to work with external data in a variety of formats. You can open tables from external data sources directly — by opening table-type Recordset objects in code. For information about how to open tables directly, see “Linking, Opening, and Importing External Tables” in Chapter 8, “Accessing External Data.”

The most flexible way to work with external data sources is to link tables to the local database (referred to as “attaching tables” in Microsoft Access versions 2.0 and earlier, and in Visual Basic version 3.0). The linked tables appear in the TableDefs collection of the database, and, if security restrictions defined for the source database don’t prevent you from doing so, you can freely query and update them as if they were local tables.

For example, it’s common in Microsoft Access applications to place all tables in a back-end database located centrally on a network server, and place the remaining application-specific objects, such as forms, reports, and modules, in a separate front-end database. Links are defined in the front-end database to the tables in the back-end database, and then a copy of the front-end database is distributed to each user. Although the front-end database doesn’t contain any tables, it looks and acts as if the linked tables are local.

This section describes how you can use DAO to add the linked tables to the local TableDefs collection of your database.

See Also For more information about working with external data sources, see Chapter 8, “Accessing External Data.”