Define relationships by using the keyboard

Define relationships by using the keyboard

  1. Close any tables that you have open. You can’t create or modify relationships between open tables.

  2. If you haven’t already done so, switch to the Database window. You can press F11 to switch to the Database window from any other window.

  3. Press ALT+T to select the Tools menu, and then press R to open the Relationships window.

  4. If your database doesn’t have any relationships defined, the Show Table dialog box appears automatically. If you need to add the tables that you want to relate, and the Show Table dialog box does not appear, press ALT+R to select the Relationships menu, and then press T to open the Show Table dialog box. If the tables that you want to relate already appear in the Relationships window, skip to step 7.

  5. In the Show Table dialog box, select the first table that you want to relate, and then press ENTER to add it to the Relationships window.

  6. Repeat step 5 for any other tables you want to relate, and then press ALT+C to close the Show Table dialog box.

  7. Press ALT+R to select the Relationships menu, and then press R to open the Edit Relationships dialog box.

  8. Press ALT+N to open the Create New dialog box.

  9. In the Left Table Name box, select the name of the table that contains the primary key.

  10. In the Right Table Name box, select the name of the table that contains the foreign key.

  11. In the Left Column Name box, select the primary key field, and in the Right Column Name box, select the foreign key field.

    The related fields don’t have to have the same names, but they must have the same data type and contain the same kind of information. In addition, when the matching fields are Number fields, they must have the same FieldSize property setting. There are two exceptions to matching data types: you can match an AutoNumber field with a Number field whose FieldSize property is set to Long Integer; and you can match an AutoNumber field with a Number field if the FieldSize property for both fields is set to Replication ID.

  12. Press ENTER.

  13. In the Edit Relationships dialog box, use the arrow keys to make sure that the two columns contain the field names you want; you can change them if necessary, or you can specify additional fields if you are using a multiple-field primary key.

    Set relationship options if necessary. For information about a specific item in the Relationships dialog box, select the item and then press F1.

  14. Press ALT+C to create the relationship.

  15. Repeat steps 5 through 14 for each pair of tables you want to relate.

Notes