Access 2019 In Practice - Ch 2 Independent Project 2-5 (2024)

Independent Project 2-5

Life’s Animal Shelter wants to expand the database created in the Independent Project 1-5 . To ensure consistency, the starting file is provided for you. In this project, you use Design view to create a second table, edit field properties, integrate data integrity rules, and enter data. You also create a relationship between the two tables and enforce referential integrity constraints. Finally, you add data using the relationship between tables.

[Student Learning Outcomes 2.1, 2.2, 2.3, 2.4, 2.6]

File Needed: LifesAnimalShelter-02.accdb (Available from the Start File link.)

Completed Project File Name: [First Name.Last Name]-LifesAnimalShelter-02.accdb

Skills Covered in This Project

  • Create a table using Design view.
  • Add fields into a table.
  • Edit field properties in Design view.
  • Create an input mask.
  • Create a validation rule and validation text.
  • Save a table.
  • Enter records.
  • Create a foreign key.
  • Create a 1:M relationship between tables.
  • Enforce referential integrity.
  • View a table in Datasheet view and expand related records.
REQUIRED:
  1. Open the LifesAnimalShelter-02 database file.
  2. The file will be renamed automatically to include your name. Change the project file name if directed to do so by your instructor, and save it.
  3. Enable content in the security warning.
  4. Create a new table using Table Design.
    1. Add the fields in Table 2-29 into the table and set field properties.

      Table 2-29

      Field NameData TypeDescriptionField Size
      OwnerIDShort TextUnique owner ID4
      OwnerLastNameShort TextLast name20
      OwnerFirstNameShort TextFirst name20
      AddressShort TextStreet address40
      CityShort Text 20
      StateShort Text 2
      ZIPShort TextZIP Code5
      PhoneShort TextContact phone number10
    2. Set OwnerID as the primary key.
    3. Select the State field and type TX in the Default Value.
    4. Save the table as Owners.
  5. Create an input mask for the Phone field.
    1. Select the Phone field.
    2. Use the Phone Number Input Mask.
    3. Don’t make any changes to the mask or placeholder character and select the Without the symbols in the mask, like this radio button.
    4. Finish the Input Mask Wizard.
    5. Save the table.
  6. Create and test a field validation rule.
    1. Select the OwnerID field.
    2. Type Like "####" in the Validation Rule.
    3. Type You must enter a 4-digit Owner ID as Validation Text.
    4. Save the table and switch to Datasheet view.
    5. Test the rule by typing 11 in the first row of the OwnerID column.
    6. Move to the OwnerLastName field. The message box should display the validation text message (Figure 2-92) since the OwnerID is not four digits long.
      Access 2019 In Practice - Ch 2 Independent Project 2-5 (1)
    7. Click OK to acknowledge the error.
    8. Delete the contents and type 1111 into the OwnerID field.
    9. Verify that you successfully move to the OwnerLastName field since 1111 meets the validation rule criteria.
    10. Delete this test data record.
  7. Enter the records in Table 2-30 into the Owners table. Life’s Animal Shelter doesn’t have any data about the owners stored electronically so you are unable to import any data. Since the State field has a default value of TX, you can simply accept that value and tab to the next field.

    Table 2-30

    OwnerIDOwnerLast NameOwnerFirst NameAddressCityStateZIPPhone
    0100SmithAlbert11 Lakewood DriveAbileneTX79601325-614-9333
    0101WestonMark2601 Nonesuch RoadAbileneTX79606325-555-1112
    0102RiveraAngela2548 Laney RoadDentonTX76208940-321-8020
    0103MoyerSilvia6867 Anglebluff CircleDallasTX75248972-380-6188
    0104WillsMason2421 Klondike DriveDallasTX75228214-224-5555
  8. Save and close the table.
  9. Determine the foreign key field. Currently, a field is not common across the Owners and Pets tables. A one-to-many relationship exists between the two tables since an owner could adopt many pets, but each pet is only adopted by one owner. The foreign key comes by taking the primary key field from the 1 table and adding it in as an additional field in the M table.
    1. Open the Pets table in Design view.
    2. Add the foreign key field below the Details field using the information in Table 2-31.

      Table 2-31

      Field NameData TypeDescriptionField Size
      FKOwnerIDShort TextMust match an OwnerID in the Owners table4
    3. Save and close the Pets table.
  10. Create a one-to-many relationship between the Owners and Pets tables.
    1. Open the Relationships window and add the two tables.
    2. Enlarge the table objects, if needed, to see all of the fields.
    3. Drag the OwnerID field from the Owners table on top of the FKOwnerID field in the Pets table. Release the pointer. The Edit Relationships dialog box displays.
    4. Select the choices to Enforce Referential Integrity and Cascade Update Related Fields.
    5. Leave the Cascade Delete Related Records check box not selected. The shelter does not want to delete pet records when it deletes information about an owner.
    6. Create the relationship.
    7. Save the changes and close the Relationships window.
  11. Enter the following data into the specified records in the Pets table to reflect which pets have been adopted:
    1. Open the Pets table in Datasheet view.
    2. Type 0100 in the FKOwnerID field for PetID 1.
    3. Type 0103 in the FKOwnerID field for PetID 3.
    4. Type 0100 in the FKOwnerID field for PetID 12.
    5. Type 0104 in the FKOwnerID field for PetID 14.
    6. Close the Pets table.
  12. View the related data records in the Owners table.
    1. Open the Owners table in Datasheet view.
    2. Click the plus sign to the left of the OwnerID field for Albert Smith, OwnerID 0100. You should see the two pets adopted by Albert.
    3. Close the Owners table.
  13. Close the database.
  14. Upload and save your project file.
  15. Submit project for grading.
Access 2019 In Practice - Ch 2 Independent Project 2-5 (2024)
Top Articles
Latest Posts
Article information

Author: Sen. Emmett Berge

Last Updated:

Views: 5864

Rating: 5 / 5 (80 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Sen. Emmett Berge

Birthday: 1993-06-17

Address: 787 Elvis Divide, Port Brice, OH 24507-6802

Phone: +9779049645255

Job: Senior Healthcare Specialist

Hobby: Cycling, Model building, Kitesurfing, Origami, Lapidary, Dance, Basketball

Introduction: My name is Sen. Emmett Berge, I am a funny, vast, charming, courageous, enthusiastic, jolly, famous person who loves writing and wants to share my knowledge and understanding with you.