ACC: "#Deleted" Errors with Linked ODBC Tables

ID: Q128809


The information in this article applies to:


SYMPTOMS

When you retrieve, insert, or update records in a linked ODBC table, each field in a record contains the "#Deleted" error message. When you retrieve, insert, or update records using code, you receive the error message "Record is deleted."


CAUSE

The Microsoft Jet database engine is designed around a keyset-driven model. This means that data is retrieved, inserted, and updated based on key values (in the case of a linked ODBC table, the unique index of a table).

After Microsoft Access performs an insert or an update of a linked ODBC table, it uses a Where criteria to select the record again to verify the insert or update. The Where criteria is based on the unique index. Although numerous factors can cause the select not to return any records, most often the cause is that the key value Microsoft Access has cached is not the same as the actual key value on the ODBC table. Other possible causes are as follows:

These factors do not directly cause the "#Deleted" error message. Instead, they cause Microsoft Access to go to the next step in maintaining the key values, which is to select the record again, this time with the criteria based on all the other fields in the record. If this step returns more than one record, Microsoft Access returns the "#Deleted" message because it does not have a reliable key value to work with. If you close and re-open the table or choose Show All Records from the Records menu, the "#Deleted" errors are removed.

Microsoft Access uses a similar process to retrieve records from an linked ODBC table. First, it retrieves the key values and then the rest of the fields that match the key values. If Microsoft Access is not able to find that value again when it tries to find the rest of the record, it assumes that the record is deleted.


RESOLUTION

The following are some strategies that you can use to avoid this behavior:


MORE INFORMATION

Note: In Microsoft Access 2.0, linked tables were called attached tables.

Steps to Reproduce Behavior


  1. Open the sample database Northwind.mdb (or NWIND.MDB. in Microsoft Access 2.0)


  2. Use the Upsizing Tools to upsize the Shippers table.

    NOTE: This table contains an AutoNumber field (or Counter field in Microsoft Access 2.0) that is translated on SQL Server by the Upsizing Tools into a trigger that emulates a counter.


  3. Open the linked Shippers table and enter a new record. Make sure that the record you enter has the same data in the Company Name field as the previous record.


  4. Press TAB to move to a new record. Note that the "#Deleted" error fills the record you entered.


  5. Close and re-open the table. Note that the record is correct.


Additional query words: pounddeleted mcsys7 kbinterop kb3rdparty


Keywords          : kberrmsg kbinterop OdbcOthr 
Version           : 2.0
Platform          : WINDOWS 
Issue type        : kbprb 

Last Reviewed: June 16, 1999