quaked2023
Technical User
hi!:
I have a question for you, how do you prevent a duplicate entry in a database?, in my aplication i request the user to put a code for every client that he checks in... the code has to be unique so in my access database i indexed with no duplicates the field code, an in my vb aplication i put this code:
But my code doesn't work i get Run-time Error '3022' that says that the changes i requested will create a duplicate value in the index..... Can you tell me if there is an other way to prevent the user from duplicating an entry?
Thanks in advance
-The Only Privacy Left Is The Inside Of Your Head!- QUAKED2023
I have a question for you, how do you prevent a duplicate entry in a database?, in my aplication i request the user to put a code for every client that he checks in... the code has to be unique so in my access database i indexed with no duplicates the field code, an in my vb aplication i put this code:
Code:
Data1.Recordset.MoveFirst
Do While Data1.Recordset("Code") <> Val(Text1.Text)
If Data1.Recordset("Code") = Val(Text1.Text) Then
X = MsgBox("The code has to be unique change it", vbCritical, "Error:")
Text1.SetFocus
Exit Sub
Else
Data1.Recordset.MoveNext
End If
Loop
But my code doesn't work i get Run-time Error '3022' that says that the changes i requested will create a duplicate value in the index..... Can you tell me if there is an other way to prevent the user from duplicating an entry?
Thanks in advance
-The Only Privacy Left Is The Inside Of Your Head!- QUAKED2023