Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2001
    Posts
    175

    Question Unanswered: Find duplicates in a table

    Hi,

    How do I find if the data a user enters in a field already exist in the table. This is to reduce duplication. e.g.

    In table curr1 has a field call currency. If the user was to enter US in the currency field, I want to check the curr1 table to see if it already exist. If it does, I want to display a message otherwise the user can continue.

    Please help!

  2. #2
    Join Date
    Jun 2002
    Posts
    33
    You can use the AfterUpdate event on that box.
    And on these event use the DCount function (in the criteria part use the parameter entered by the user). If Dcount returns a record it means that there is already a record there and you generate a message.
    OK?

    Bye
    PacuIonut

  3. #3
    Join Date
    Sep 2001
    Posts
    175
    Thanks. Much appreciated

  4. #4
    Join Date
    Nov 2001
    Posts
    336
    Hi,

    You can set an index on the field, which doesn't allow duplicates. When someone enters duplicate value, the update errors out. Just set appropriate error handler to catch this type of error and give the user descriptive message.

    Another approach would be to use combobox instead of textbox, so user will always choose from the list of predefined options.

    Just my 2 cents.

    Igor

Posting Permissions

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