Results 1 to 9 of 9
  1. #1
    jerryg72 is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Dec 2021
    Posts
    5

    Exclamation Prevent entry of duplicate Personal ID Number


    Hello friends, I am a novice in MS Access. My employee database has a field for serial number which is Autonumbering, and I have another field to enter his 12 digit personal ID Number (similar to SSN). First of all, prior to adding his personal details I need to make sure that his Personal ID number is not entered already, I need to prevent entering duplicate Personal ID number. Make note that this field is Indexed Yes (No Duplicates). Moreover I want to restrict entering data on all other fields prior to entering his unique personal ID number. Is there a way to to do this? Your help is greatly appreciated. Thanks

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Use textbox BeforeUpdate event to validate input with DLookup() domain aggregate function.

    Set other controls as disabled in design then use ConditionalFormatting to enable after input of ID Number. Set a rule that ID Number textbox is not null.
    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
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    at text box ID entry:

    this code assumes the ID is text (not numeric)
    Code:
    vID = Dlookup("[PersID]","table","[PersID]='" & txtID & "'") & ""
    
    if vID <> "" then msgbox "This ID exists" exit sub endif 'otherwise add the new entry


  4. #4
    jerryg72 is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Dec 2021
    Posts
    5
    Personal ID is numeric

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726

  6. #6
    jerryg72 is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Dec 2021
    Posts
    5
    These are just a 12 digit number...eg: 278051201235. First "2" represents the class/grade, 2-7 digits are his birthday and the last 5 is the sequence/series

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    I'm pretty sure this is a text field with only numeric characters. Show the definition in the table.
    Did you try the suggestions from the others?
    Relational databases work very well with 1 fact, 1 field (atomic data). Personal/custom combination/codification of several fields can be treacherous --just sayin'. But individual field definitions and then subsequent concatenation for display is quite common.

  8. #8
    jerryg72 is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Dec 2021
    Posts
    5
    You are right. This is a text field with numeric characters.

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726

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

Similar Threads

  1. prevent duplicate client entry
    By kelliejean in forum Programming
    Replies: 5
    Last Post: 09-18-2020, 06:41 AM
  2. Replies: 3
    Last Post: 07-04-2020, 10:20 AM
  3. Prevent duplicate value
    By IvanGAa in forum Forms
    Replies: 1
    Last Post: 03-11-2020, 01:18 AM
  4. Replies: 4
    Last Post: 12-21-2015, 10:57 PM
  5. Prevent Duplicate Entry
    By kilosierra71 in forum Forms
    Replies: 4
    Last Post: 07-28-2011, 03:08 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