Note that there are some explanatory texts on larger screens.

plurals
  1. POMS Access “Update or CancelUpdate” error using Find dialog
    text
    copied!<p>We have an MS Access 2007 database with a simple form displaying table data. We use the Find dialog (click the binoculars on the Home ribbon) to locate records we want. This can cause an error under specific circumstances.</p> <p>Steps to reproduce the problem:</p> <ol> <li>Open the form.</li> <li>Open the find dialog.</li> <li>Edit some field within the record. The record is now in update mode (you'll see the pencil in row's "gutter" area).</li> <li>Without saving the record, click on the ALREADY open Find dialog.</li> <li>Search for a record that can't be found.</li> <li>Click on the form again. The record is still in edit mode (i.e. the pencil still shows). Attempt a save or edit some other field.</li> <li>This message box will display "Update or CancelUpdate without AddNew or Edit." You can click OK or Help buttons.</li> </ol> <p>Clicking the Help button shows:</p> <blockquote> <p>You tried to call Update or CancelUpdate or attempted to update a Field in a recordset without first calling AddNew or Edit. (Error 3020)</p> <p>On a Microsoft Access database engine database, you called the Update or CancelUpdate method but did not use the AddNew or Edit method before writing data to a record.</p> <p>On an ODBCDirect database, this error occurs when you attempt to write data to a record without first calling AddNew or Edit.</p> </blockquote> <p>We’ve reproduced this in a new database where there is no VBA code. So the problem is solely within MS Access, and you should be able to reproduce it easily.</p> <p>If you save the record before doing the find, the problem doesn’t happen. Unfortunately, we have users doing a find while the record is still in edit mode.</p> <p>We’ve tried setting up form-level, data-field-level, and Access application level events and error handling. Nothing can detect or catch this situation. There is no way within VBA to detect if the Find dialog is active.</p> <p>Does anyone have any ideas for preventing the error or a way to save the record before the find occurs? Our best thought right now is to create an AutoHotkey or AutoIt script that waits for the Find dialog to have focus. We’ll then send a Ctrl+S to save the current record to force a save.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload