Duplicates Records

J

Jose Perdigao

Good afternoon,

1. How can I customize a message to replace MS Access message when the
primary key is duplicated?

2. How can I customize a message to replace MS Access message when a field
is required?

Any suggestions?

Thanks,
jose perdigao
 
C

Corey-g via AccessMonster.com

Jose,

You need to use error handling, then test for those particular error numbers.
I assume you are working with VBA already. In your calling function that
adds the new record, add a error handling line:

public sub something()
on error goto <<your_error_handler_name>> <-- this is where you need to be
....
....
sub_exit:
EXit SUB
<<your_error_handler_name>>:
Case statement to test what error number and handle accordingly
end sub

I did a quick search of the VBA window's help for On Error statement, and it
has everything you need.

HTH,

Corey
 
Top