Results 1 to 5 of 5
  1. #1
    Desstro's Avatar
    Desstro is offline Competent Performer
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    185

    Question Referential Integrity

    I have created 4 tables. All Tables have the same primary key. How can I set referential integrity between all of them? I can do it between 2 but not all.



    Really what I'm looking to do is once I put the data into the primary key in one table, I want the other three tables to automatically fill in the same data in the related field.

    Please help me.

  2. #2
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    You would have one primary table and with a unique identifier like an auto-id field. You would then create a relational field in the other tables. Let's say that you are using an auto-id field for your primary key in the main table. You would create a numeric type field in your child fields. You would then set the relationship of your ID field in your main table with the numeric relational field in the child tables. You cannot have values in the relational id fields that are not in the ID field in your main table. That's all you gotta do and then check the referential box.

  3. #3
    Desstro's Avatar
    Desstro is offline Competent Performer
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    185

    Referential Integrity

    Ok....thanks.

    Here is a snap shot of what I have. Could you tell me how to do what you previously replied?

  4. #4
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    You would set it up exactly as I said. I'm assuming that the "Package Number" in the 3 tables is an auto-id field and that's what you're trying to use as your relationship. You need to remove the primary key from all those tables and change those fields to be numeric types, so you can set the relationships with your main table.

    These forums are a great place to get answers but they are more intended to help guide you in development. I would highly-suggest that you take the time to learn relational database basics. Once you have the basic concepts down, which is the foundation then everything else is going to make alot more sense to you and you'll learn alot faster because you'll understand the answers people are giving you and the logic behind them.

    Quote Originally Posted by Desstro View Post
    Ok....thanks.

    Here is a snap shot of what I have. Could you tell me how to do what you previously replied?

  5. #5
    Join Date
    May 2010
    Posts
    339
    Dan makes some excellent points, if you notice in your three tables you have "Package Number" and in the first table its like this "PackageNumber"

    I would use a naming convention on all tables, fields, querys and reports. Also get rid of spaces in your field names, I say this only because it will cause coding problems down the road.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Referential Integrity
    By U810190 in forum Access
    Replies: 1
    Last Post: 03-29-2010, 05:21 PM
  2. Referential Integrity
    By jbarrum in forum Access
    Replies: 5
    Last Post: 01-14-2010, 09:04 AM
  3. Data preventing Referential Integrity
    By RubberStamp in forum Access
    Replies: 0
    Last Post: 12-14-2008, 05:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums