Duplicate message box

G

Guest

Hi...

Can u pls.anybody suggest for my below query..?

My query is....

I set Primary key for 4 field together as i need to check duplicate values
for these 4 field. When i enter the data into the form, it restricts to enter
the duplicate values by giving the below message.
"The changes you requested to the table were not successful because they
would create duplicate values in the index,primary key, or relationship.
Change the data in the field or fields thagt contain duplicate data,remove
the index,or redefine the index to permit duplicate entries and try again."

But, i need to show this message as my desired message in the message box
like "Eh..! its duplicate value" ONLY. And, also, i would like to indicate
this message at the lost focus of the last field(ie.,4th field).

And, can I indicate this type of my desired message for any duplicate
value...?

Please suggest me....

Thnx..in advance..

Solar.
 
A

Allen Browne

To replace the built-in error message with your own, write some code in the
Error event of the form. For the duplicate-index error, DataErr will be
3022.

To notify the user as soon as the 4th box is filled in, use the AfterUpdate
event procedure of this text box to see it the value is already in the
table. Use DLookup(), as explained here:
http://allenbrowne.com/casu-07.html
In your case, the Criteria string will consist of 4 parts, e.g.:
"([F1] = " & Me.[F1] & ") AND ([F2] = " & Me.[F2] & ") AND ([F3] = ...
 

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

Top