Results 1 to 6 of 6
  1. #1
    cp3 is offline Novice
    Windows 10 Access 2021
    Join Date
    Mar 2023
    Posts
    15

    Relationship ID's between tables


    Hey yall,
    I have a database with two main tables used for contacts and check-ins. Both tables have an ID category and both are the primary keys for their individual tables. Both are also auto-numbers. I want to make sure that when a particular record (and its related ID) are entered in one table (i.e. the contact table) they match to the corresponding record in the check-in table when that is entered subsequently. I am new to relationships on Microsoft Access (pun intended ) so how would I go about doing this? Is it ok to have both as auto-numbers and primary keys? I made the relationship in the tab as a one to one but I'm not confident that I have this right? Thanks so much for your support and advice!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    I assume it should be one to many rather than one to one. If I'm a contact, I can presumably check in more than once. I don't know what a check in represents in your world of course. An employee can clock in multiple times, a customer can check into a hotel multiple times, etc.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    cp3 is offline Novice
    Windows 10 Access 2021
    Join Date
    Mar 2023
    Posts
    15
    Ok yes thats correct we will have multiple check-ins. So if i need to make this one to many how do i set that up with primary keys and how is the relationship drawn if both tables have an ID column. Are both ID's autonumbers? Do i make the relationship tied between the ID variables or from one ID in one table to a different variable in the other table?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    I should have explained more, sorry. I would expect a "ContactID" field in contacts and a "CheckinID" in the check in table. Both autonumbers, both primary keys, but NO relationship between them. In the check in table I'd expect a ContactID field, which would be a foreign key to the ContactID field in contacts with a one to many relationship.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    cp3 is offline Novice
    Windows 10 Access 2021
    Join Date
    Mar 2023
    Posts
    15
    Ah gotcha thanks so much this is incredibly helpful!!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Happy to help! Post back if you get stuck.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 5
    Last Post: 11-26-2013, 11:11 PM
  2. RelationShip between Tables
    By joe357 in forum Forms
    Replies: 3
    Last Post: 08-20-2012, 06:01 PM
  3. relationship between tables
    By jassie in forum Access
    Replies: 1
    Last Post: 03-27-2012, 05:14 PM
  4. Relationship between tables
    By kpk in forum Database Design
    Replies: 3
    Last Post: 10-14-2011, 11:49 AM
  5. relationship between the tables
    By mer in forum Queries
    Replies: 1
    Last Post: 07-05-2011, 05:52 AM

Tags for this Thread

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