Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / March 2007

Tip: Looking for answers? Try searching our database.

Duplicate message box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
solar - 16 Mar 2007 06:56 GMT
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.
Allen Browne - 16 Mar 2007 08:00 GMT
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] = ...

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> Hi...
>
[quoted text clipped - 24 lines]
>
> Solar.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.