Results 1 to 4 of 4
  1. #1
    mackoski is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    2

    Unique ID's across multiple fields

    I am working on a database of biological samples and test data. A problem is that many times the same subject has multiple ID's. For example, one subject may have the ID "ID234" but they previously had the ID "Sub84" or something like that. I want to be able to have 3 or 4 fields that have ID's for a subject, and I don't want a single one of them to be repeated. So I have column a, b, c, and d, and I don't want to have one record to have the same ID in column a as another record has in column d and so on. Is there a way to do this? All I have been seeing is a way to make sure all of a, b, c, and d are unique combinations, but I want none of the fields to be repeated.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Maybe ValidationRule property:

    for fieldA: <>[fieldB] AND <>[fieldC] AND <>[fieldD]

    for fieldB: <>[fieldA] AND <>[fieldC] AND <>[fieldD]

    etc.

    If that doesn't work, then probably need VBA behind a form.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    mackoski is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    2
    Quote Originally Posted by June7 View Post
    Maybe ValidationRule property:

    for fieldA: <>[fieldB] AND <>[fieldC] AND <>[fieldD]

    for fieldB: <>[fieldA] AND <>[fieldC] AND <>[fieldD]

    etc.

    If that doesn't work, then probably need VBA behind a form.

    Thanks for your reply, but would this work for multiple records? This seems like it only works within a single record, making sure those fields are different within that record but not for the whole table.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    ID234 or Sub84 should not repeat in any field across all records? Each would be unique in the entire dataset?

    Have you set each field as Indexed Yes(No Duplicates)?

    Then along with the above ValidationRule, think will prevent duplicates.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. validation of unique fields
    By thanosgr in forum Programming
    Replies: 3
    Last Post: 05-02-2012, 09:59 AM
  2. Count Unique Fields and then get Average
    By Kirsti in forum Queries
    Replies: 5
    Last Post: 02-19-2012, 07:25 PM
  3. Creating a unique index on two fields
    By Paul H in forum Database Design
    Replies: 3
    Last Post: 11-03-2011, 10:15 AM
  4. Assign Unique IDs to Multiple Tags
    By willbmisled in forum Queries
    Replies: 1
    Last Post: 02-02-2011, 10:11 PM
  5. Unique Values and Boolean Fields
    By Triad in forum Forms
    Replies: 1
    Last Post: 07-15-2010, 06:28 PM

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