<p>Occasionally my MS Access reports: </p>

<blockquote>
  <p>The search key was not found in any record</p>
</blockquote>

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

<p>What causes this and how can I avoid it?</p>

You do not mention the version of Access that you are using. Microsoft reports a bug in 2000:
BUG: You receive a "The search key was not found in any record" error message when you compact a database or save design changes in Access 2000
http://support.microsoft.com/kb/301474
If this is not your problem, here is a pretty comprehensive FAQ by Tony Toews, Microsoft Access MVP:
Corrupt Microsoft Access MDBs FAQ
http://www.granite.ab.ca/access/corruptmdbs.htm
If the problem is constantly occuring, you need to find the reason for the corruption of your table, and you will find a number of suggestions for tracking the cause in the site link above.