Microsoft Office Professional 2010 Step by Step eBook

(Ben Green) #1

818 Chapter 26 Create Databases and Simple Tables



  1. On the Design contextual tab, in the Relationships group, click the Show Table
    button. Then in the Show Table dialog box, double-click the Employees table, and
    click Close.
    Access adds a box listing all the fields in the Employees table to the Relationships
    page.

  2. On the page, drag the title bars of the three field lists to arrange them so that
    they are side by side and equidistant.

  3. In the Employees field list, click the EmployeeID field, and drag it down and over
    the EmployeeID field in the Orders field list. Then in the Edit Relationships dialog
    box, select the Enforce Referential Integrity check box, and click Create.

  4. After Access draws the relationship line between the primary key and the foreign
    key, close the Relationships page, clicking Yes to save its layout.

  5. Open the Orders table. Then in the CustomerID field of the first record, type 11 ,
    and click below the record to complete it.
    Access displays a message box telling you that you cannot add the new record to
    the table.


The value in the CustomerID field in the Orders table must match a value in the primary key
CustomerID field in the Customer table.


  1. Click OK. Then change the value to 1 , and click below the record to complete it.


This time, Access accepts the value because there is a record with the value 1 in the
primary key CustomerID field of the Customers table.
CLEAN UP Close the Orders table, and then close the My Tables database.
Free download pdf