Vous êtes sur la page 1sur 3

Department of Accounting & Information Systems College of Business & Economics

IS 628, Introduction to Computer-based Information Systems Spring 2010 Lab Tutorial in Access This page consists of a self-guided tutorial of Microsofts Access database management application. The tutorial provides instruction for only those functions needed to import data from an Excel worksheet file, create normalized data table, define the data structures, and establish relationships between the tables to arrive at a usable database. For this exercise, you are provided with a database in the Microsoft Access database management system (DBMS) format. It contains tables of data for employees working in the Marketing Department of an organization and descriptions of Marketing Department Job Titles. Missing from the database is data for the location of the marketing offices the employees are assigned to. This data, contained in a spreadsheet file, needs to be imported into the database, and formatted to build the database that will be used for future analysis. Start with the demonstration database file: Download and save to disk the MarketingPersonnel.zip folder. This is a compressed format folder which contains the MarketingPersonnel.mdb demonstration database file. The file is in compressed format. I have done this to get the file around some of the firewalls that block Access files because such files contain executable code. To extract the database file once you have saved the folder to your computer, simply double-click on the folder and follow the instructions. The database file is in MS Access 2003 (2000) format. You may complete the tutorial using either MS Access 2003 or the newer 2007. The Location data table for Marketing Employees: The data that needs to be added to the MarketingPersonnel database is contained in the LocationData.xls Excel spreadsheet file. The easiest way to move this data into the Marketing Employees is to import it using the Get External Data function of Access. Download the LocationData.xls file in the same manner in which you downloaded the MarketingEmployees.mdb file. Open the Marketing Employees Database: Once the file has been extracted, you may navigate to the file and double-click to open the file. You may have to answer some questions related to security issues. You may presume that the file has been received from a trusted source. Import the LocationData contents as a table: Select the External Data tab, and click Excel icon in the Import section.

IS 628: Introduction to Computer-based Information Systems

Spring 2010

Follow the instructions in the wizard to navigate to and import the worksheet data into the Marketing Employees database. Click the box to select the first row values as the field names. Do not modify the field properties in the wizard. That is easier to do in the Table Design View. Do not set the primary key; again, that is easier to do in the Table Design View. All of the fields contained in the Location.mdb files will be added to the Marketing Employees.

Create the Location table: While the imported LocationData table contains the necessary Location data, it is only in first normal form (1NF) and contains employee data that you do not need. You need to extract normalized location data from this table into a separate Location table indicated in the Marketing Employees database data dictionary. Select the Create tab and Query Design icon. The query Design View will be launched and the Show Table dialog will be displayed. Add the LocationData table and close the dialog. Add the fields for the Location table as indicated in the data dictionary. Since any particular Location can have multiple marketing employees, the Location data is repeated in the 1NF data table for each employee. A way of eliminating the repeated rows is to use the grouping function that will leave only one entry for each repeated row. The following step will eliminate the redundant rows. Click the Totals icon Notice that a row named Totals: has been added to the field design section of the query design view and that the value Group By has been displayed for each field. Click the Run (!) icon and see that the correct data is displayed with the correct number of rows for the table as indicated in the data dictionary. Click the Design icon to return to Design View. Change the Query Type to Make Table and name the table Location. Save the query naming it Make Location. Run the query and note that a new table (Location) has been created. Modify table format and establish the primary keys: You will need to change the field properties of the new Location table to match the specifications shown in the Data Dictionary. Open the Location table in Design View (point at the Location table object name, right click and select Design View from the menu). Change the table properties, add captions and then set the primary key to reflect the properties listed in the data dictionary. Establish the Primary Key of the Location table and verify the table format: Open the Location table in Design view and change the table properties to create the primary key to reflect the properties listed in the Marketing Employees database data dictionary. Establish the Relationships: Select the Database Tools tab and the Relationships. Access Tutorial Page 2

IS 628: Introduction to Computer-based Information Systems

Spring 2010

The MarketingEmployees and Title tables will be displayed in the Relationships dialog. Click the Show Table icon and add the Location table to the dialog. Click and hold on the Foreign Key field name in the related table and drag it to the Primary Key field name of the Primary table and release. (See the table specifications on the project instructions page if necessary to identify the Foreign Key fields.) The Edit Relationships dialog will be displayed. Make certain that the Primary table name and Primary Key field name are listed under the Table/Query: column. Make certain that the Related table name and the Foreign Key field name are listed under the Related Table/Query: column. Click the boxes to select the following options (see figure): Enforce Referential Integrity. Cascade Update Related Fields. Cascade Delete Related Records. Click Create to create the relationship and close the dialog. Repeat the above steps to create the remaining table relationships. That is, all foreign key fields need to be related to the appropriate primary key field. The completed relationships should be as expressed in the figure.

Now that the data fields have been properly configured and you have established the appropriate relationships, the data tables may be queried to manipulate and process the data into meaningful information. Create and interpreting queries is what Part II of the database project is about.

Copyright 2010 This document created and maintained by David W. Miller. This document is for the exclusive use by students in the above named course. The page was last updated on February 2, 2010.

Access Tutorial

Page 3