Error Number for Duplicate Record

  • Thread starter Thread starter Daniel
  • Start date Start date
D

Daniel

When adding a record and it turns out to be duplicate when
the form is closed? What is the error number? Can code be
written "If Error = 123245 then
MsgBox 'This is the error'
Resume Next
End if"

Thanks

Dan
 
Use the Error event of the form, and trap DataErr 3022.

You may also wish to trap:
3201 Related record required;
3314 Required field missing;
2113 Invalid data type.
 
Back
Top