Importing Records From

ITBIS 251 MS ACCESS

Importing Records from an External Source

When adding data to tables, you might find that some of the data that you want in your database already exists in a Microsoft Excel worksheet, an HTML file, a text file, or a table from another database program. Although you could print the data and type it in your database, it is easier to import the information into Access from the source.

To import data:

Ä  The field names in the source must be identical to the field names in the table where the data is being copied.

Ä  The data types in the source must be compatible with the data types in the table where the data is being copied.

For example, if a field in the source contains text and you attempt to copy it into a table for which the corresponding field is a number, you’ll receive an error message.

THE BOTTOM LINE

Since a database management system (DBMS) such as Access provides such powerful and flexible methods for working with data, you might want to convert other existing files to a database table. Access can import text data from a word processing file, spreadsheet data, Web pages, or even from other database files and database programs and automatically create Access tables from those files, or add data to existing tables.

Import Excel spreadsheet data to an Access table

You are going to practice how to import data from an excel spreadsheet to the CDs database (Table Exercise 2).

1.  On the File menu, point to Get External Data, and click Import.

2.  Click the files of type down arrow, and locate and click on the Microsoft Excel (*.xls) option.

3.  Select the file name to select it (CDs data), and then click Import.

4.  The import wizard will appear, and then follow up the wizard steps.

5. Select the needed worksheet, in which the data related to the CDROM table are stored.

6. Include the column headings that should match the field names in your Access table (CDROM).

7. Select to import the needed data in the CDROM table existing in the CDs Database (MS Access).

8. Click finish.

Now you can work with your Access tables.

Ø  If it takes a long time to import a spreadsheet, an error might have occurred. You can cancel the import process by pressing the Ctrl+Break keys.

Note: the above steps are only for importing data to an existing table in MS Access. If you are importing data to a new table in MS Access, then an additional step is going to ask you for selecting a Primary Key for your table.

Prepared by: Sara Ghanem