Microsoft Access: Lesson 22 - Database Maintenance, Import, and Export
Importing data allows you to get information from an external source and insert it in your database.
Microsoft Access can accept data from various applications, and with a little trick, you can import even from unfriendly applications. Before importing data, you must make sure that it is in a format
Microsoft Access can read; even if that data is coming from another application of the Microsoft
Office suite.
1. From the resources that accompany our lessons, locate a text file named Customers, a Microsoft
Excel spreadsheet named Employees, and a Microsoft Access database named Georgetown
2. Copy and paste them in your Exercises folder
3. In Microsoft Access, create a new blank database named GCS
As you are already familiar with Microsoft Access functionality, you know that a cell is delimited with gridlines. If you intend to import a text document, format it so that Microsoft Access can recognize where a field starts and where it ends. Such a file can be created with Notepad. This delimiter is usually done by pressing Tab when creating the fields' content and pressing Enter at the end of each record. Instead of the Tab key, you can also use a comma or a semi-colon to separate two fields.
Since a field is usually made of more than one word (such as an address), enclose the content of each field in double quotes, as in "1600 Pennsylvania Avenue".
When importing data, you use a wizard that will assist you in identifying the document, the fields’ delimiter, and the target table where you would like to store the new data. You can create a new stable or use one already created in your database
1. Start a text application, such as Notepad (Start -> (All) Programs -> Accessories -> Notepad)
2. Open the Customers.txt file to see what it looks like. Then close Notepad
3. On the main menu, click: File -> Get External Data -> Import...
4. Locate your Exercises folder and display it in the Look In combo box
5. Click the arrow of the Files Of Type combo box and select Text Files
6. On the list of files, click Customers (it should be selected already) and click Import
7. On the first page of the Import Text Wizard, accept that the text be Delimited and click Next
8. On the second page, set the delimiter as Comma and check the box stating: First Row Contains
Field Names http://www.functionx.com/access/Lesson22.htm (1 of 12)7/3/2007 2:45:12 PM
Microsoft Access: Lesson 22 - Database Maintenance, Import, and Export
9. Click Next
10. Accept to store the data In A New Table and click Next
11. Click the Notes column to select it then, in the Data Type combo box, select Memo http://www.functionx.com/access/Lesson22.htm (2 of 12)7/3/2007 2:45:12 PM
Microsoft Access: Lesson 22 - Database Maintenance, Import, and Export
12. Click Next
13. Accept to Let Access Add Primary Key and click Next
14. Finally, you are asked to give a name to the table.
Accept the name of the table as Customers http://www.functionx.com/access/Lesson22.htm (3 of 12)7/3/2007 2:45:12 PM
Microsoft Access: Lesson 22 - Database Maintenance, Import, and Export
15. Click Finish.
You should receive a confirmation message when the table has been imported
16. Click OK
17. In the Database window, click Tables and double-click the Customers table to see what it looks like
18. Close the Customers table http://www.functionx.com/access/Lesson22.htm (4 of 12)7/3/2007 2:45:13 PM
Microsoft Access: Lesson 22 - Database Maintenance, Import, and Export
Microsoft Access objects are probably the easiest objects to import because, created with of the same application, these objects are already formatted and recognizable.
To import objects from another Microsoft Access database, you can use the main menu or the New
Table dialog box.
1. The GCS database should still be opened.
On the main menu, click File -> Get External Data -> Import…
2. Locate your Exercises folder and display it in the Look In combo box. Change the Files Of Type combo box to Microsoft Access
3. Then, click Georgetown and click Import
4. In the Import Objects property sheet, click the Forms property page
5. In the Forms property page, click OrderProcessing
6. Click OK
Linking data allows you to connect your database to an external document. Such a table can have its data accessed directly or modified in Microsoft Access. When linking data, since you are making it available to the database, make sure that Microsoft Access can "read" it; otherwise it would not recognize its content. The main reason you link data is to treat your database as one file despite its belonging to another document. Linking to a spreadsheet is usually a straightforward process.
Linking to a word processing document usually involves performing a mail merge.
http://www.functionx.com/access/Lesson22.htm (5 of 12)7/3/2007 2:45:13 PM
Microsoft Access: Lesson 22 - Database Maintenance, Import, and Export
1. The GCS database should still be opened.
On the main menu, click Insert -> Table
2. In the New Table dialog box, click Link Table
3. Click OK
4. Locate your Exercises folder and display it in the Look In combo box. Click Georgetown and click
Link
5. In the Link Tables property sheet and in the Tables property page, click OrderProcessing
6. Click OK
7. In the Database window, click Tables
http://www.functionx.com/access/Lesson22.htm (6 of 12)7/3/2007 2:45:13 PM
Microsoft Access: Lesson 22 - Database Maintenance, Import, and Export
When creating a spreadsheet in Microsoft Excel for data import, you have two alternatives. You can create the column headers at the very top of the worksheet and type a data field in each corresponding column. Alternatively, you can create data as on a table, and then create a name range that holds the information you need in the database. To import a Microsoft Excel spreadsheet, on the main menu, you can click File -> Get External Data -> Import. Locate the file that holds the spreadsheet and click Import. You would be asked to specify what to import, a whole spreadsheet or a named range.
There are various circumstances when you will need to link to a spreadsheet rather than importing it. The main idea is to accommodate your users. To link to a spreadsheet, you use the same approach.
1. Start Microsoft Excel if you have it. From your Exercises folder, open the Employees spreadsheet to see what it looks like. Then close Microsoft Excel and return to Microsoft Access.
The GCS database should still be opened.
On the main menu, click File -> Get External Data -> Link Tables…
2. Locate your Exercises folder and display it in the Look In combo box
3. Change the Files of Type to Microsoft Excel and click Employees (it should be selected already
4. Click Link
5. In the first page of the Link Spreadsheet Wizard, accept the Show Worksheets radio button and, in the list, click Employees http://www.functionx.com/access/Lesson22.htm (7 of 12)7/3/2007 2:45:13 PM
Microsoft Access: Lesson 22 - Database Maintenance, Import, and Export
6. Click Next
7. On the 2nd page, make sure the First Row Contains Column Headings check box is selected and click Next
8. Accept the name of the table as Employees and click Finish
9. A message box lets you know that the table has been linked.
Click OK http://www.functionx.com/access/Lesson22.htm (8 of 12)7/3/2007 2:45:13 PM
Microsoft Access: Lesson 22 - Database Maintenance, Import, and Export
10. To view the table in Microsoft Access, double-click the Employees linked table
11. After viewing the table, close it
Importing a Microsoft Outlook document is mainly done on the address book level and is as smooth as what we have seen so far. All you have to do is have the address book already created and you are ready to go.
The following exercise is not supposed to be performed here; it is provided as a guide
1. On the Database toolbar, click the arrow of the New Object button and choose Table
2. In the New Table dialog, double-click Import Table
3. In the Import dialog, change the Files of Type to Outlook
4. A particular wizard starts. In the first page of the wizard, click the + on Personal Folders to expand it http://www.functionx.com/access/Lesson22.htm (9 of 12)7/3/2007 2:45:13 PM
Microsoft Access: Lesson 22 - Database Maintenance, Import, and Export
5. Click Contacts and click Next
6. Accept to store data In A New Table and click Next
7. Click Next, Next, Finish, and OK
process of doing this is different from one version of Microsoft Access to another. We will cover only Microsoft Access 2000.
http://www.functionx.com/access/Lesson22.htm (10 of 12)7/3/2007 2:45:13 PM
Microsoft Access: Lesson 22 - Database Maintenance, Import, and Export
1. Open the Rockville Techno database
2. In the Database window, click Queries. Right-click AssetsInventory and click Exports…
3. In the Export Query dialog box, locate and display your Exercises folder in the Save In combo box
4. In the Save As Type combo box, select HTML Documents
5. Click Save
6. Still in the Queries section of the Database window, click AssetsAssignedToEmployees to select it
7. On the main menu, click File -> Export…
8. Make sure the Save As Type displays HTML Documents. Click the Save Formatted check box and click Save
9. On the HTML Output Options dialog box, click the Browse button
10. Locate the folder in which you installed Microsoft Access or Microsoft Office. Open the Templates folder. Open the 1033 folder. Open the Pages folder. Open the Normal folder http://www.functionx.com/access/Lesson22.htm (11 of 12)7/3/2007 2:45:13 PM
Microsoft Access: Lesson 22 - Database Maintenance, Import, and Export
11. Click Normal and click OK
12. On the HTML Output Options dialog box, click OK http://www.functionx.com/access/Lesson22.htm (12 of 12)7/3/2007 2:45:13 PM