Courses/Computer Science/CPSC 203/CPSC 203 Template/Fall 2009 Teaching Assistants/F09 Thomas Burt/Lab 2.2

From wiki.ucalgary.ca
Jump to: navigation, search

Store.accdb

Please download the new database file from http://pages.cpsc.ucalgary.ca/~teburt/Store.accdb

One-To-Many Relationships

Scenario

Many of our products have a long list of features. They are stored as a comma separated list. When we first had our store website built, the designer became irate at the sight of commas and instead displayed them in a bulleted list. However, now whenever we forget a comma, the features merge into one another and it's a big pain. We want to make it so product features are easier to maintain.

Related Table

To accomplish this, we're going to change our Product.features field from a text into a list. This will take two steps:

  1. Adding a new table called Product Features
  2. Creating a new sub-form on our Product form
  3. Migrating the commma-separated values into the new table

We'll put off step #3 unless we have time at the end of the tutorial (it's a real pain and you won't need to know how to do it).


Create Table

  1. Create a new table called Product Features
  2. Create two fields:
    1. "Feature Text" > Text
    2. "Product" > Lookup...
  3. Create a new form for Products
  4. Add a subform that is linked to the Product Features table.