Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2006
    Posts
    7

    Unanswered: preventing duplicates

    have a field in my database titled "access code" i want to set it up so that there can not be duplicated added into this field..I've set the index to no duplicates, but i want a warning to appear right away..how can i do this...i have someone tell me to use the expression builder but I'm not sure how to use it....my table is "membership info" the field name is "access code" the input mask is ">LLLLLL0000"

  2. #2
    Join Date
    Nov 2006
    Posts
    67

    Question

    Quote Originally Posted by notawiz_gettinby
    have a field in my database titled "access code" i want to set it up so that there can not be duplicated added into this field..I've set the index to no duplicates, but i want a warning to appear right away..how can i do this...i have someone tell me to use the expression builder but I'm not sure how to use it....my table is "membership info" the field name is "access code" the input mask is ">LLLLLL0000"
    Out of curiosity, if you have already indexed that field to No Duplicates, shouldn't an error message comes up when you try to enter something that's not unique in that field? The error message is something like "there are one or more duplicate fields, blahblah," and it forces you to change the entry. Then why are you implementing a new error message (or a warning)?

  3. #3
    Join Date
    Dec 2006
    Posts
    7

    Question

    Yes it does that..but only when you are trying to close the form..I'm wondering if it can tell a user that BEFORE they move on to the next feild.

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    ?? something like

    in the _LostFocus event of that textbox

    if dcount("fieldNameInTable", "nameOfTable", "fieldNameInTable = " & me.NameOfTextbox) > 0 then
    msgbox "Dupes not allowed", vbexclamation, "FIX IT!"
    me.NameOfTextbox.setfocus

    izy
    currently using SS 2008R2

Posting Permissions

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