Issuu on Google+

Full file at http://testbank360.eu/solution-manual-exploring-microsoft-office-access2010-comprehensive-1st-edition-grauer

ACCESS, CHAPTER 2 Scripted Lecture

Relational Databases and Queries This set of exercises mirrors the Hands-On Exercises throughout this chapter, following the same steps as the textbook exercises but based on a different scenario. It may be useful for inclass demonstration. Travel Club You are the itinerary planner for a small vacation club. You have several trips coming up within the next two years and have decided to move your information from Excel to Access.

Table Design, Properties, Views, and Wizards To set up your database, you need to create a new table to store hotel information. 1. Create a New Database a. Start Microsoft Access. Click Blank database. Type exp2010_a02_script_travel as the name. Click Browse, change to the desired location, click OK, and then click Create. 2. Create a Table by Entering Data a. Type PA03 in the second column, first row. Press Tab. Type 3102 in the third column, Duminey Vendome in the fourth column, and 125 in the fifth column. b. Press Tab three times. Enter the following record: LO01, 3180, Wellington Court, 155. c. Enter the third record: PA04, 3102, Marsai Villa, 148. Click Save. Type Hotels as the name. 3. Change the Primary Key, Modify Field Properties, and Delete a Field a. Click View. Delete the ID field row. Click Yes to both messages. b. Change Field1 field name to HotelID; Field2 to TripID; Field3 to HotelName; and Field4 to PricePerNight. Make HotelID the Primary key field. Click Save. 4. Modify Table Fields in Design View

Copyright Š 2011 Pearson Education, Inc. Publishing as Prentice Hall. 1


Full file at http://testbank360.eu/solution-manual-exploring-microsoft-office-access2010-comprehensive-1st-edition-grauer a. Make the following changes:    

HotelID: Field Size–4; Caption–Hotel ID; Indexed–Yes (No Duplicates). TripID: Data Type–Text; Field Size–4; Caption–Trip ID. HotelName: Field Size–40; Caption–Hotel Name. PricePerNight: Caption–Price Per Night; Data type–Currency.

5. Create a New Field in Design View a.

Click in the first blank row below the PricePerNight field name, and then type PartnerDate. Specify Data Type of Date/Time; Description of This is the partnership date; Caption of Partnership Date; Format of Short Date. Click Save. Click Yes at the warning message.

6. Switch Between the Table Design and Table Datasheet Views a. Right-click the Hotels tab. Select Datasheet View. Click in the Partnership Date field in the first record, and then click Calendar. Select January 1, 2008. For the second record, select April 11, 2010. For the third record, select May 2, 2011. b. Click the File tab, click Print, and then click Print Preview. Close Print Preview. Close the Hotels table.

Multiple Table Databases Other information that was previously stored in Excel can be imported into Access. You need to modify data types and field properties as well as create relationships between your tables. 1. Import Excel Data into an Access Table a. Click the External Data tab, and then click Excel in the Import & Link group. Select the Import the source data into a new table in the current database option. Click Browse, and then go to the student data folder. Select exp2010_a02_script_travelers. Click Open, and then click OK. b, Click Next twice. Click the Indexed arrow, and then select Yes (No Duplicates). Click Next. Click the Choose my own primary key option, and then select TravelID from the selection box. Click Next. Enter Travelers in the Import to Table box, if necessary. Click Finish. Click Close. 2. Import Additional Excel Data

a. Click the External Data tab. Click Excel. Select the Import the source data into a new table in the current database option. Click Browse to select exp2010_a02_script_trips. Click Open, and then click OK. b. Click Next twice. Click the Indexed arrow, and then select Yes (No Duplicates). Click Next. Click the Choose my own primary key option, and then select

Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 2


Full file at http://testbank360.eu/solution-manual-exploring-microsoft-office-access2010-comprehensive-1st-edition-grauer TripID. Click Next. Enter a table name of Trips. Click Finish, and then click Close. 3. Modify an Imported Table’s Design a. Double-click the Travelers table. Switch to Design view. Make the following changes:        

Add a caption to the TravelID field of Travel ID. FirstName: Caption–First Name; Field size–30. LastName: Caption–Last; Field size–30. Zip: Change field name to ZipCode; Caption–Zip Code; Data Type–Text. Phone: Remove @ from the Format field. PastGuest: Caption–Past Guest; Data Type–Yes/No. TripID: Data type–Text; Caption–Trip ID; Field Size–4. BalanceDue: Data type–Currency; Caption–Balance Due.

b. Type a new field name JoinDate under the BalanceDue field name. Use the following properties: Data type–Date/Time; Caption–Join Date; Format–Short Date. Click View. Read the messages, and then click Yes twice. c. Add Join Date values for the first two records of March 22, 2010 and September 12, 2011. d. Right-click the Trips table. Select Design view. Make the following changes:    

TripID: Data Type–Text; Field Size–4; Caption–Trip ID. TripName: Caption–Trip Name; Field Size–100; remove @ symbol from Format field. DepartureDate: Caption–Departure Date; Data Type–Date/Time; Format–Short Date from the Format field property. ReturnDate: Caption–Return Date; Data Type–Date/Time; Format–Short Date. Click Save.

e. Click OK in both messages. Close the Trips table. Click the Travelers table tab. Switch to Design view. Click the ZipCode field name, and then click Input Mask in Field Properties. Click Build. Click Zip Code. Click Next. Remove the hyphen and four 9s from the Input Mask. Click Finish. f.

Click the Phone field name, and then click Input Mask. Click Build, and then click Save. Select the Phone Number Input Mask. Click Finish. Click Save.

4. Add Data to an Imported Table

a. Click View in the Views group to display the Travelers table in Datasheet view. Click the Travel ID field in the last blank record. Type 1011. Fill in the rest of the

Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 3


Full file at http://testbank360.eu/solution-manual-exploring-microsoft-office-access2010-comprehensive-1st-edition-grauer data using your information as the customer. Use fictitious info for all fields except the TripID field. For TripID, type 3200. Close the Travelers table. b. Open the Trips table. In a new row, click in the Trip ID column. Type 3200 as the Trip ID, Scottish Charm as the Trip Name, and 8 for the Duration. Type 9/3/2011 for the Departure Date and 9/11/2011 for the Return Date. Close the Trips table. 5. Establish Table Relationships

a. Click the Database Tools tab, and then click Relationships. Add all tables to the window. Close the Show Table dialog box. Create a relationship between the TripID field in the Hotels table and the TripID field in the Trips table. Check Enforce Referential Integrity and Cascade Update Related Fields. Click Create. b. Create a relationship between the TripID field in the Trips table and TripID field in the Travelers table. Check Enforce Referential Integrity and Cascade Update Related Fields. Click Save, and then close the Relationships window. 6. Test Referential Integrity

a. Double-click the Hotels table. Add a new record: Hotel ID, IT02; Trip ID, 3250; HotelName, Caesars Villa; PricePerNight, 200; PartnershipDate, 10/12/10. Press Tab, explain the error message; and then click OK. b. Double-click on Trips table. Note there is no 3250 record. Close the Trips table. Replace 3250 with 3150 in the new Hotels record. Press Tab three times. Close the Hotels table. Reopen the Hotels table, and then verify the change for IT02. Close all tables.

Single Table Queries You decide to test your database structure by experimenting with criteria specifications and sorting. 1. Create a Query Using a Wizard a. Click the Create tab, and then click Query Wizard. Click OK. Click the Tables/Queries arrow, and then select Table: Travelers (if necessary). Select TravelID, and then click the > button. b. Add FirstName, LastName, TripID, TripName, and BalanceDue fields to the query. Click Next. Confirm Detail is selected, and then click Next. Name the query Balance Due. Click Finish. 2. Specify Query Criteria and Sorting

Copyright Š 2011 Pearson Education, Inc. Publishing as Prentice Hall. 4


Full file at http://testbank360.eu/solution-manual-exploring-microsoft-office-access2010-comprehensive-1st-edition-grauer a. Click the Home tab, and then click View. Type 3102 as criteria for TripID. b. Sort the LastName column as Ascending. Click Run, and then save the query. 3. Change Query Data a. Click the BalanceDue field in the record for TravelID 1005. Change $1,450 to $1400. Press Enter. Close the query. Open the Travelers table; confirm the change for Travel ID 1005. b. Open the Travelers table, and then locate Travel ID 1007. Change the balance due to $100.00. Close the Travelers table. Open the Balance Due query.

Multi-Table Queries You will generate a list of all travelers who have upcoming trips with a balance due that is greater than $2,000.00. You will then modify the query. 1. Add Additional Tables to a Query a. Right-click the Balance Due query, and then select Design View. Drag the Trips table from the Navigation Pane to the design grid. Drag the TripName field from the Trips table to the grid. b. Add the Duration field from the Trips table to the design grid. Click the Show check box under TripID. Remove the existing criteria from TripID. Remove the Ascending sort from LastName. Type 7 as a criterion for Duration, and then press Enter. Sort the BalanceDue field in Descending order, and then click Run. c. Click View. Drag the Hotels table from the Navigation Pane to the top portion of the design grid. Drag the HotelName field in the Hotels table to the left of the Duration field column in the design grid. Delete the TripName field. Press Delete, remove the criteria from the Duration field, and then click Run. Save, and then close the query. 2. Create a Multi-Table Query a. Click the Create tab, and then click Query Design. Double-click each table name in the Show Table dialog box. b. Click Close in the Show Table dialog box. Double-click the following fields: LastName, FirstName, BalanceDue, TripID. Type >= 2000 as criteria for BalanceDue. Click Run, click Save, and then type Scheduled Trips-Balance Over 2000 as the name.

Copyright Š 2011 Pearson Education, Inc. Publishing as Prentice Hall. 5


Full file at http://testbank360.eu/solution-manual-exploring-microsoft-office-access2010-comprehensive-1st-edition-grauer 3. Modify a Multi-Table Query a. Click View. Type <=1500 in place of >2000 as criteria for the BalanceDue field. Double-click the DepartureDate field to add it to the design grid. Type <8/8/2011 as criteria for DepartureDate. Run the query. b. Click the File tab, and then click Save Object As. Type Balance Less than 1500 Trips Prior to August 2011. Click OK, click the File tab, and then click View. Sort the DepartureDate field as Ascending. Click Run. Save, and then close the query.

Copyright Š 2011 Pearson Education, Inc. Publishing as Prentice Hall. 6


Solution manual exploring microsoft office access 2010 comprehensive 1st edition grauer