Results 1 to 6 of 6
  1. #1
    SeniorCitizen is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Dec 2021
    Posts
    32

    Duplicate keys in a table

    I'm looking for a way to allow multiple records with the same key but rest of the data is different.
    It is a case where multiple occurrences will appear to the same OwnerID and the same month.
    The table has an OwnerID, as a number and primary key, indexed and Duplicates OK
    Also a Month field as number and primary key.
    If this is not possible, as I suspect, is there a better way to accomplish this?

  2. #2
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,144
    If the month was an actual date, would you ever have a duplicate date?
    I'm puzzled by the requirement really, If this was a sales table, you have a SalesID - unique primary key, a CustomerID not unique in the sales table, but unique in the customers table.

    What/why are you worried about saving a duplicate value if what sounds like a related table?

    What is the data and what are your tables?
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    keys prevent duplicates.
    add another key?

  4. #4
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    I'm looking for a way to allow multiple records with the same key but rest of the data is different.
    Consider composite index. I can't recall if I've ever used Allow Dupes with a PK field. It doesn't make sense to me. Even if I have a composite index I have at least an autonumber PK field so that every record has a unique identifier - just in case.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    SeniorCitizen is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Dec 2021
    Posts
    32
    I have a work around. Thanks

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,280
    Quote Originally Posted by SeniorCitizen View Post
    I have a work around. Thanks
    Well, please share it.
    Therse forums are to help others after all?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

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

Similar Threads

  1. Replies: 9
    Last Post: 10-28-2020, 06:01 PM
  2. Replies: 3
    Last Post: 02-02-2020, 11:18 AM
  3. Replies: 8
    Last Post: 12-16-2018, 06:45 AM
  4. Table allowing duplicate primary keys
    By Count Duckula in forum Access
    Replies: 4
    Last Post: 06-13-2013, 09:12 AM
  5. Using keys from one table to another
    By Bubbadubya in forum Access
    Replies: 1
    Last Post: 03-21-2013, 01:50 PM

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