Improve company productivity with a Business Account.Sign Up


Key violation error

Posted on 2004-04-21
Medium Priority
Last Modified: 2012-08-14
I am an end user of a program that uses a Paradox v5 database for the entries.  I have had nothing but problems with this, but most I have been able to fix using the table repair utility.  Recently, we started getting a "Key Violation" error when we try to save a new entry.  I attempted to fix the database and rebuild it, but this error continues to appear.  Note that this has never done this until recently (less than a week ago).  How can I repair this so we can use our program again?  We use this program on a day-to-day basis and I would like to get this repaired ASAP!  Thanks!
Question by:kvalley9599

Expert Comment

ID: 10883685
You are trying to reuse a key that is already in the table. Please find out your primary key columns/unique constraint columns that have an existing value for the data that you are trying to insert.

Expert Comment

ID: 10883745
Hmmmm...I couldn't tell you, since the solution *probably* lies in the program, not damage to the database.  

It is possible that there is some internal record counter within the program that writes its information to a unique key.  For example, something that creates invoices has a record of the last invoice number used.   In the invoice table, there may be a field for the invoice number that needs to be unique (there can only be one invoice record with the number #1015, for example).  If somehow, an invoice with #1016 gets written to the table without the program's internal counter of the last invoice record used getting incremented, the program will try to create another invoice #1016 and get a key violation.

In a nutshell, my thought is that the answer is not going to come from repairing the back-end database, but rather from someone who has experience with your specific application.

Accepted Solution

allinb earned 2000 total points
ID: 10895974
You can use Access 2003 to link to the tables and get a look at the data. You will need to download the latest ISAM drivers from Microsoft as there are published TK's in regards to Paradox and the initial release of Access. Once you have a link established to the tables you can scan through the data an perform queries that can help you locate the record and if you have the BDE engine running on your machine you can make the record go away or even repair it with Access, that is if it can be located. Look very closely at the last record or group of records entered if they can be identified.....

Since you are the end user you may want to consider contacting your IT department (You did not mention If you had one) or if your company has a technical resource that they normally contract with to perform this as you will need to be somewhat comfortable with Access to do this type of mining operation.

Author Comment

ID: 10902354
It seems like the problem is boiled down to the database because we were able to add records to previous copies of the same database.  Unfortunately, even if we are able to use a backup, there are about 200+ records that would need to be re-entered.  Can Access update paradox tables with the newest Jet drivers?

Expert Comment

ID: 10902434
You have to have the BDE engine installed as a prerequisite as well as the updated ISAM drivers but yes.  Either way you sound like you are going to have to restore from the backup. If you can get access to work like microsoft says it will then you will save yourself the leg work of re-entering 200 orders.

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

What we learned in Webroot's webinar on multi-vector protection.
In this article, we will show how to detach and attach a database and then show how to repair a corrupt database and attach it, If it has some errors. We will show how to detach and attach using SSMS or using T-SQL sentences.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question