Question : Can't delete a record - The Search Key Not Found In Any Record

I have an access database which appears to have a corrupt record in it. I would like to blow away the corrupt record then compact and repair my database; however, things are not working as smoothly as normal. I will try to best describe what I can/can't do and the symptoms below. Any suggestions are welcome a solution would be great. Feel free to ask more questions.

First I made a copy of the DB and tried to Compact and Repair. That process continues to crash time after time so that is not an immediate option.

Description of my table relationships
I have a table "TABLE1" with a composite primary key (Two Fields)
I have another table "TABLE2" with a one to many based off of that key
"TABLE2" has a composite key consisting of three fields
"TABLE3" and "TABLE4" have one to one relationships with "TABLE2" based on the three keys
I am forcing Referential Integrity with cascade update and delete through all of these

When I try to delete the record from TABLE1 I get an error:
'The search key was not found in any record'

This record does not exist in TABLE2; however, it should since it exists in TABLE3 and TABLE4 somehow.

If I try to add the record into TABLE2 it tells me that I can't because I would be creating a duplicate value in the index, primary key, or relationship .

I then was able to delete the record from TABLE3 and TABLE4

I then went back and tried to add it to TABLE2 and it still refuses me.

I then went back and tried to delete from TABLE 1 and I still get the 'Search key not found' error

I clicked the top left corner of the table view in TABLE1 which selects all records I hit delete and it appears that the record was deleted; however, if I close the table and open it back up it is still there.

Now if I open up TABLE2 I have one record with all fields showing #Deleted
Remember I was enforcing Cascading Delete so it removed all records from TABLE2 when I DELETED records from TABLE1. The thing is this record never existed in TABLE2.

TABLE 3 and TABLE4 look fine at this point.


I then deleted the relationships among all these tables.

I now tried to delete the row from TABLE2 showing '#Deleted' in all fields
Nope it just stays there despite the lack of an error.

Now I go to TABLE1 and try to delete this record
It now deleted.

Now I go back to TABLE2 and try to delete that record showing '#Deleted'
I just cant get rid of it.

Now I tried Compact and Repair. It finally works.
It then leaves me with a MSysCompactError table with one record
ErrorCode -1026
ErrorDescription: "Could not find field 'Description'"
ErrorRecid
ErrorTable 'TABLE2'

Has anyone experienced anything like this before? What is the best way to resolve this without loosing any data other than that corrupt record which is of minimal importance.

Thanks for reading this long winded issue.

Answer : Can't delete a record - The Search Key Not Found In Any Record

Sounds like it's time to hire this out to a professional recovery service, or restore from a recent backup and rebuild the data that was lost.

There are several recovery services available, here's a Google link that will show you quite a few:

http://www.google.com/search?q=access+database+recovery&rls=com.microsoft:en-us:IE-SearchBox&ie=UTF-8&oe=UTF-8&sourceid=ie7
Random Solutions  
 
programming4us programming4us