Results 1 to 3 of 3
  1. #1
    faodavid is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Aug 2014
    Posts
    17

    How to prevent entering duplicate records when using forms

    Hi
    Is there a way of preventing entering duplicate data when using forms? i.e. I am entering Venue name which 99% of the time should be unique, other data is address, toen, county, region and postcode
    Thanks


    Dave

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    IMHO form validation is best done in either the forms Before Update event or the Before Update event of individual controls. These events can be cancelled if a duplicate is found.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    What exactly is/are the table(s) behind the Form? Do you have a Primary key? Do you have a unique composite index on the fields you "might" duplicate?
    Do you have any error handling code in form events?

    You might want a Lookup table(s) for Town, County, Region and Postal Codes.
    As Bob said the BeforeUpdate event (form or control) is "best" place for validation.
    You might check for Dcount(some unique value) > 0 then "duplicate"....
    Good luck.

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

Similar Threads

  1. Replies: 3
    Last Post: 03-10-2014, 08:51 AM
  2. Replies: 4
    Last Post: 12-18-2013, 06:52 PM
  3. How to prevent duplicate records
    By talktime in forum Programming
    Replies: 7
    Last Post: 05-15-2013, 11:02 PM
  4. Prevent duplicate records for calculated field
    By LoveLEE143 in forum Access
    Replies: 3
    Last Post: 05-03-2013, 11:46 AM
  5. Replies: 2
    Last Post: 02-12-2011, 09:54 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