Access Foreign keys define the relationship between tables (MDB)

Source: Internet
Author: User

 

Define the relationship between tables (MDB)  
Show all

When creating the relationship between tables, the associated fields do not have to have the same name, but must have the same field type, unless the primary key field is an "automatic number" field. Only when the "Automatic number" field is the same as the "field size" attribute of the "Number" field can the "Automatic number" field be matched with the "Number" field. For example, if the "field size" attribute of an "automatic number" field and a "Number" field is "long integer", they can match. Even if both fields are "Number" fields, they can be matched only when they have the same "field size" attribute settings.

Define one-to-many or one-to-one relationships

    1. Close all open tables. You cannot create or modify relationships between opened tables.
    2. Press F11 to switch to the Database window.
    3. Click relationship on the toolbar ".
    4. If no relationships are defined in the database, the "show tables" dialog box is displayed automatically.

      If you want to add the table to be joined"Display table"The dialog box is not displayed. Click"Display table".

    5. Double-click the table name and close the "show tables" dialog box. To establish a relationship between the table and itself, add the table twice.

    6. Drag the required field from a table to another table.

      To drag multiple fields, press Ctrl, click each field, and drag these fields.

      In most cases, the primary key field (displayed in bold) in the table is dragged to a similar field named foreign key in other tables (often with the same name ).

    7. The Edit link dialog box is displayed. Check the field names displayed in the two columns to ensure correctness. Changes can be made if necessary.

      Set link options as needed.

    8. Click "CREATE" to create a link.
    9. Repeat steps 5th to 8th for each table to be associated.

      When you close the relationship window, Microsoft Access will ask if you want to save the layout. Whether or not the configuration is saved, the created link is saved in this database.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.