tags:

views:

3613

answers:

5

Occasionally my MS Access reports:

The search key was not found in any record

After this happens the solution is to close Access, compact and repair the backend and then delete the record.

What causes this and how can I avoid it?

A: 

It sounds like you might have a corrupt database. One way you might be able to identify the source (especially if its something in the application portion of it) is to use the no-so-documented /decompile command it (make a backup firs of course); and then recompile it in the VBA side using the Debug->Compile command.

From there, it would be a matter or replacing the corrupt object (form/report/module).

CodeSlave
The "Search Key Not Found" is a Jet error, i.e., data-related. Decompile is VBA-related (i.e., *not* Jet-related), so decompiling won't have any effect whatsoever on a data error.
David-W-Fenton
+1  A: 
Remou
A: 

Another possible cause of this error is a mismatched workgroup file. That is, if you try to use a secured (or partially-secured) MDB with a workgroup file other than the one used to secure it, you can trigger the error (I've seen it myself, years ago with Access 2000).

David-W-Fenton
A: 

These are the steps which i follows may be it is useful for you,

  1. Go to menu-tools-database utilities-compact and repair database.

  2. when repairing database delete or update that record.

  3. it is working finely.

A: 

In Access 2007 this error occurs when importing an Excel file where there are two fields with the same column header.

bfox
Er, no, it doesn't happen in that circumstance -- I just tested (with the wizard and with TransferSpreadsheet) and it imports it just like it did in earlier versions of Access, providing a unique name for the duplicate column. It may be that this error *also* happens sometimes when importing, but it's independent of having duplicate column headers in the source spreadsheet.
David-W-Fenton