How to prevent duplicate data entry in a text box??
Posted on 1997-05-15
Hi I have a simple form for data entry, the MDB file contains 4 fields, and I have a form with 4 text boxes bounded to the MDB file. My question is how do I prevent a duplicate entry on the text box??
I have a simple procedure but it gives me runtime error 3426 ??
' After entering data hit the check_duplicate button to
' check for duplicate entry
Private Sub CheckDuplicateButton_Click()
strBookmark = ContractData.Recordset.Bookmark
' CQuote is the textbox name which bound to the MDB file field [Quote #]
strCriterion = "[Quote #]= '" & UCase(CQuote) & "'"
If ContractData.Recordset.NoMatch Then
ContractData.Recordset.Bookmark = strBookmark
MsgBox ("Duplicate Contract # Entry!!")
If I enter a quote# which previously exist it gives me runtime error 3426??
Any idea from you guys or any better way?? Oh I am using VB4.0.