Computer Science 125 Microsoft Access Project Due Date : Tuesday, March 4th, 11:59 PM 50 points In this project, you will use Microsoft Access to create two databases : a student database and a coffee database. I. The Students Database Table Structure First off, create a folder named Databases on your thumb drive. We will be setting up a table structure to support a 15-record, 11-field database with the field names and data types listed below. ID (autonumber & primary key) Last Name (text) First Name (text) Street Address (text) City (text) State (text) Zip Code (number) Birthdate (date/time) Age (number) Married? (yes/no) Choose one other field of your choice (email address, web page address, phone number, social security number, etc.).
Setting up your Table Structure 1. Now, in our class folder, copy the MS Access icon for Students and paste it into your folder named Databases on your own drive. Next, open up this database. If a security warning window pops up, close it. 2. In the main database window, the Tables category should be selected. Look in the far left column, and be sure Tables is selected from the dropdown box. An icon for Table1 should now appear under the Tables category. Doubleclick the icon for Table1 to open this table. You should currently have a five record, seven field database. 3. Now, Select Design View from the View dropdown box. The View dropdown box is just below the Office home button. We will use Design View to set up the structure of your database file. The cursor will be at the first field. 4. Seven field names & types have already been set up. You need to add the three additional field names listed above after Zip Code as well as the final field name of your choice. So, click in the field name box below Zip Code. 5. Type in each field name and then tab over to Data Type. Choose the field type from the arrow options (or you can just type the first letter of the type). Hit the tab key to move over to the next column. You can leave the Description column blank. Enter the other field names and their field type. Be sure you use the data type that is listed in parentheses above. Return to the leftmost column of the first field name, ID, and right click. Be sure this first field is selected as your primary key. 6. At a later time, you may want to modify your table design. That is, add or delete a field, or change a field type. To do this, simply return to the Tables category, click on your table and click on Design. Re-save your new design, and then your changes will be in effect in Open mode. Entering Your Data Open Table1 and enter your data directly into the table. You can make up fictitious data, but it must be reasonable. One of the names must be your own name. Make up ages that range from 4 to 80 and include at least one who is over 40 and is married. (We ll need that for a query.) Be sure and save when you re done. Your data can be real or fictitious. If you need to enter a state not available among your selections, simply type it into the field box. Make sure you have a total of 15 records when you re done. 2
Report Now, select the Create Tab & select the Report Wizard icon Using the Report Wizard, create a report on your data. Choose all fields except Zip Code and ID, using the arrow >. Move on to the next window in the wizard by clicking Next. In the grouping window, just click next. In the sorting window, you want to sort the records in descending order with last name as the primary sort key and first name as the secondary sort key. You would click on the Ascending button to change to descending order. Choose Tabular and Landscape at the next window, and choose any print style you like on the style window. For the title, use Report 1 by <your name>. Queries To create a query, select the Create tab, and then the Query Design option. Select your Table1 as the table to perform the query on by selecting it followed by the Add button. Close out this window when done. In the first three field columns of the Query Design window, use the black down arrows to select Last Name, Age, and Married? in that order. Save this file as Query1 and then close out this window. Now, in the Category dropdown box on the left, select Queries from the dropdown box. Your Query1 icon should be listed there. Open it up to see the results of your query just completed. Create another query to print the same information as the first query, but choose ONLY students who are older than 8 and are married. Use the Criteria field to enter these restrictions (simply type > 8 under Age and a Yes under Married?). Save this query as Query2. Create a third query to print out each last name by minimum age. To set this query up, use last name and age as your field boxes. In the Criteria field, do a right click and select totals. A Total row should now appear. In the Total field for Age, select Min and select ascending for your sort. Save this query as Query3. Create a fourth query which displays the overall average of everyone in your database. To set this query up, use only age as a field box. In the Criteria field, do a right click to select Totals once again. In the Total field for Age, select Avg. While this field is selected, select View, Properties from the menu bar. Under the General tab, choose Standard formatting and two decimal places. Save this query as Query4. 3
Mail Merge A mail merge allows us to merge our database of students with a form letter in word processing so that we can quickly personalize the same letter to everyone in our database. To set up your mail merge, open a blank word processing document in Microsoft Word. Type up a short one-paragraph letter with the current date which can be used to announce an upcoming event or party to a large audience. As you type your letter, leave blank the spots which you want to be personalized with data from your database. The items that you will be personalizing include the first name, last name, street address, city, state, and zip in the recipient s address and the first name in the salutation (i.e., following the Dear ). If you want to personalize some items directly in the text body, that is fine. When you re done typing your letter, select Mailings, Start Mail Merge, Step by Step Mail Merge Wizard from within MS Word. This option provides us with a quick tutorial in the right hand column of how to do a mail merge. First, make sure the radio button for using letters is selected and then click next at the bottom of the column. Next, at step 2, select use the current document and click next. At step 3, select use an existing list and then double click on the Browse option. At the bottom of the Select Data Source window, go to the window labeled Files of Type and choose Access Databases. Next, go to your Look In box at the top of the window and open your database from your thumb drive. After you ve found and selected your database, you need to select which table within your database you want. We ve only got a Table1, so it will go ahead and pop up a mail merge recipients window. Select OK at the bottom of this window and then move on to step 4. You re now ready to personalize your letters with the data in your database. Just click on one of the items in the right hand column within your letter that you want personalized from your database. The More items option lets you access your individual field names. Go ahead and add all of them before you close out the window of field names that pops up. Go back and add proper spacing and punctuation within all fields. For example, within an address you would have something like : <<City>>, <<State>> <<Zip Code>> When you re done typing your letter, add one piece of clip art to your letter. Save your letter as Form Letter. 4
II. Valle Coffee Database 1. Create a new database. Name it Valle Products. 2. Create a table using the design properties listed below. Make sure you select Product Code as your primary key. Field Name Data Type Description Field Size Other Properties Product Code Text Primary Key 4 CoffeeCode Text 4 Price Currency Price for this product Fixed Decimal Places : 2 Decaf Text D if decaf, Null if regular 1 Default Value : D BackOrdered Yes/No Back-ordered from supplier? 3. Specify ProductCode as the primary key, and then save the table as Product. 4. Add the product records shown below to the Product table. ProductCode CoffeeCode Price Decaf BackOrdered 2316 JRUM 8.99 Yes 9754 HAZL 40.00 D No 9309 COCO 9.99 D No 5. Make the following changes to the structure of the Product table: (a) Add a new field between the CoffeeCode and Price fields using these properties: Field Name: WeightCode Data Type: Text Field Size: 1 (b) Move the BackOrdered field so that it appears between the WeightCode and Price fields. (c) Saved the revised table structure. 6. Update the Product table with these WeightCode values for the 3 records: A for Product- Code 2316, A for ProductCode 9309, and E for ProductCode 9754. 7. Create a report with the Report Wizard. When the Report Wizard asks, What Sort Order do you want for your records?, select the Price field from within the dropdown box. Give the report an appropriate title. Close out your database when you re done. 5
8. Now, let s work with another database that is set up with the exact same design. Goto the Database folder on our class server and select (but not open) the Additional Coffee database icon. Right click on this icon and copy this database into the clipboard. Now, go into your current database folder on thumb drive, and past this icon. (That s a really neat and easy way to copy any file by the way!) 9. Open up the table file within this database, and take a look at the data that has been added. 10. Using a query, accomplish the following. Save each one appropriately as Querya through Queryh. (a) Display all fields for the products that have a WeightCode of E. (b) Display the ProductCode, CoffeeCode, Price, and BackOrdered fields for all backordered coffee. (c) Display the ProductCode, CoffeeCode, and Price for all decaf coffee. (d) Display the ProductCode, CoffeeCode, and Price for all products whose CoffeeCode begins with an M. (Hint: Use the wildcard character *. That is, M*.) (e) Display the ProductCode, CoffeeCode, and Price for all products whose Price is more than $45. (f) Display the ProductCode, CoffeeCode, WeightCode, and Price for all products whose WeightCode is A and whose price is $9.99 or more. (g) Display the ProductCode, CoffeeCode, and Price for all products whose CoffeeCode begins with COL. (h) Display the ProductCode, CoffeeCode, WeightCode, and Price for all products whose WeightCode is C or whose CoffeeCode is IRSH. (Hint: Put the C in the Criteria: line for WeightCode and the IRSH in the or: line for CoffeeCode.) 11. Paste your eight query files above (Querya -- Queryh) into a MS Word document. Type in appropiate headings above each query. Save this file as one document. 6
Submit Email me each of these items. 1. Your Students database 2. Your Additional Coffee database 3. Your MS Word document with your eight query files 4. Mail Merge Letter by <your name> (your form letter) 7