Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2004
    Posts
    6

    Lightbulb Unanswered: Duplicate Record Double Check Question

    Is there any way to create a double check to see if a user entered in duplicate data that already exists in a table? I don't want this to prevent the user from entering in duplicate data, but just merely create a warning window alerting him/her that duplicate data exists. Each record in the table has 10 fields. I don't know if that information matters though.


  2. #2
    Join Date
    Jul 2004
    Posts
    125
    First, you have to decide which field or combination of fields are considered duplicate and then there are various methods can be implemented. When it comes to names and addresses, this is nearly impossible because typos and misspellings will create a unique record. In this case the area code and the phone would be used as a check.

  3. #3
    Join Date
    Jul 2004
    Posts
    6
    I have 5 fields that I'd like to be used to to check if I have duplicate records. What can I implement to perform this check.

  4. #4
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    HI

    I would suggest the DCount Domain function ie


    Dim NumOfDuplicates as Integer
    Dim Criteria as String

    Criteria = “Field1Name = “ & F1ControlName & _
    “ AND Field2Name = “ & F2ContorlName & _
    “ AND Field3Name = “ & F3ContorlName & _
    “ AND Field4Name = “ & F4ControlName & _
    “ AND Field5Name = “ & F5ControlName


    NumOfDuplicates = DCount(“PrimaryKeyFieldName”,”TableName”, Criteria )

    If NumOfDuplicates > 0 then
    ‘ advise duplication
    Else
    ‘ No duplicates found
    end if



    You will need single quotes round any field criteria that are not number after the = sign ie

    Criteria = “Field1Name = ‘” & F1ContrlName & _
    “’ AND Field2Name = “ & F2ContrlName & _
    etc

    Just a idea

    MTB

  5. #5
    Join Date
    Oct 2003
    Location
    London
    Posts
    341
    Hi guys,

    I've got a similar problem here...

    Would anyone be able to help me modify the written code so that I can advise the user that there is a duplicate record and give him the choice to;

    a) ignore the first record and create the duplicate

    or)

    b) cancel the current record and select the first record

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •