Linking Access Tables
To link a table from another Access database to your database, do the following:
- Open the Access database to which you want to link the table. If that database is already open, close any objects so that only the Navigation pane is visible.
- On the External Data tab, in the Import & Link group, click the Access command, and then select Link To The Data Source By Creating A Linked Table in the Get External Data - Access Database dialog box.
- Click Browse to open the File Open dialog box, which lists the types of databases you can link. Select the folder and the name of the .accdb,
.mdb, .mda, .accda, .mde, or .accde file that contains the table to which you want
to link. (You cannot link tables from an .adp or .ade file because those are actually
tables in SQL Server-use an ODBC link to the server directly.) If you're connecting over a network, select the logical
drive that is assigned to the network server containing the database you want. If you
want Access to automatically connect to the network server each time you open the
table, type the full network location (also known as the UNC or Universal Naming
Convention name) in the File Name box instead of selecting a logical drive. For
example, on a Windows network you might enter a network location such as
\\dbsvr\access\shared\northwind.accdb
After you select the Access database file you want, click Open to return to the Get External Data - Access Database dialog box, and then click OK to see the tables in that database. - Access opens the Link Tables dialog box, shown next, which lists the tables available
in the database you selected. Select one or more tables, and click OK to link the
tables to the current database. If the link procedure is successful, the new table will
have the name of the table you selected.
Access marks the icon for linked tables in the Navigation pane with an arrow. If Access finds a duplicate name, it generates a new name by adding a unique integer to the end of the name as described earlier. Because objects such as forms, reports, macros, and modules might refer to the linked table by its original name, you should carefully check name references if Access has to rename a linked table.
One problem with using linked data in an application that you're going to distribute to someone else is the location of the linked files on your computer might not be exactly the same as it is on your user's computer. For example, the internal Connect property might point to D:\MyDatabases\MyData.accdb, but your user installs the application on the C drive. You might have noticed that a form always opens when you open the Conrad Systems Contacts sample database and that it takes a few seconds before it returns you to the Navigation pane. We wrote code behind this initial form that verifies the table links and fixes them.
In this tutorial:
- Importing and Linking Data
- Open Database Connectivity (ODBC)
- Creating a Data Source to Link to an ODBC Database
- Importing vs. Linking Database Files
- Importing Data and Databases
- Importing SQL Tables
- Importing Access Objects
- Importing Spreadsheet Data
- Importing a Spreadsheet
- Importing Text Files
- Modifying Imported Tables
- Linking Files
- Linking Access Tables
- Linking dBASE Files
- Linking Text and Spreadsheet Files
- Linking SQL Tables
- Modifying Linked Tables