Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

duplicate records 1

Status
Not open for further replies.

youdaman

Technical User
Dec 26, 2001
66
0
0
US
Hello all; I have a database which has a field I set to Index (Yes-No duplicates). When the user does enter a duplicate tracking number, then hits save, the record looks like it saves but never writes to the table. I would like a popup or error to display so they know that the tracking number entered is a duplicate. Any help would be great! Thanks
 
If you do error-checking (using On Error and checking the value of Err.Number) if you get an error of 3022 the user entered a record which results in a duplicate key. You can trap the error and send a message box when one is found.

For example:

On Error Goto Trap_Errors

(put your Save coding here)

Trap_Errors:
If Err.Number = 3022 Then MsgBox "This tracking number already exists. Please try another tracking number."
Resume Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top