Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2009

    Unanswered: Check on values inserted in a mask

    Hi,i would like to avoid the insertion of double records,during the writing of a mask.
    Setting the Avoid Duplicate Inserts options from the DB, it shows the generic error message(when the user puts a value that is already in the DB),but it is possible to change it into a msgbox error ?

    Thanks to all

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    you should be able to trap for that error.

    one technique would be to place some code behind the relevant controls before update event and do say a dlookup to see if that value already exists and take appropriate action

    if you know you will be doing this often then avoid using a dlookup as its expensive in resources and time. consider using a docmd.execute or other sql construct to test if the value already exists

    another approach may be to trap for a specific error, however that technique may only work if you are using unbound controls

    you may have to use a SQL query given that you need to test if the value already exists.. and it will exist if you edit the record. so you need to test if that record exists when adding but only one (or none) exist when editing.
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Dec 2009
    Ok but i'm a my idea is to check the inserted data and use the AFTER_UPDATE routine to check the value if it is inserted or not

    But i don't know how can use one field of the mask in VBA

Posting Permissions

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