Duplicates Records

  • Thread starter Thread starter Jose Perdigao
  • Start date Start date
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top