SECTION 4
Lesson 4.2 Using Excel with Other Programs and Files

   

 

 

In this exercise, you will import data from an Access database using a query.

 

 

1.

To begin, Start Excel 2003, and choose Data->Import External Data-> New Database Query from the menu bar.

 

 

If the optional query feature is not installed, Excel should prompt you to Install it. Once the query feature is installed, performing the actions above will display a Choose data source box.

 

 

Make sure the Use the Query Wizard check box is checked, and then choose MS Access Database from the list of options and click OK.

 

 

 

 

2.

When you see the select database dialogue box, use the folders in the directories area of the box to navigate to your Excel 2003 Practice folder. In the database name box, select Practice14.mdb by clicking on it.

 

 

When you are ready, click the OK button to invoke the query wizard.

 

 

 

 

3.

 

In the area under the Available tables and columns heading, you will see a list of the database tables available to select from. Click the + sign next to the table named Employees to show the fields in the table that you can choose from. Click the Name field, from the Employees table, and then click the > arrow button to put the word Name in the area under the Columns in your query heading.

 

Do the same for the Phone and Hours worked fields. Note: you can select multiple fields from multiple tables if you wish.

 

 

The query wizard should now look like this.

 

 

4.

Click Next to move to the next step in the Query wizard.

 

This part of the wizard will help you create a query, (much like a filter) that will be used to access the database. Select the Hours worked field, and from the first drop list choose is greater than or equal to. From the next drop list on the immediate right, choose 25. This query will now only import the records for employees that work 25 hours or more. Notice that you can select And / Or radio buttons to add more criteria to make your query more specific. Click Next to continue.

 

 

 

5.

 

In the next query wizard box, select the name field as the field to sort the records by, and choose the Ascending radio button, then click Next to continue. You should then see the final stage of the query wizard.

 

In this box, select Return Data to Microsoft Excel. Note that you can also choose to save the query, or view or edit the query as well. When you are ready, click finish.

 

 

6.

In the Import Data box, select Existing worksheet, and click on cell A1 to enter it as a cell reference, then click OK

 

 

 

 

 

 

 

These are the records from the Access database after being filtered by the query you designed. If you click the red exclamation mark on the External data toolbar, any changes to the records in the database will be refreshed in the worksheet.

 

Save your work and exit Excel.