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:
- Having an update or insert trigger on the table, modifying the key value.
- Basing the unique index on a float value.
- Using a fixed-length text field that may be padded on the server with the correct amount of spaces.
- Having a linked ODBC table containing Null values in any of the fields making up the unique index.
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.
- Avoid entering records that are exactly the same except for the unique index.
- Avoid an update that triggers updates of both the unique index and another field.
- Do not use a Float field as a unique index or as part of a unique index because of the inherent rounding problems of this data type.
- Do all the updates and inserts by using SQL pass-through queries so that you know exactly what is sent to the ODBC data source.
- Retrieve records with an SQL pass-through query. An SQL pass-through query is not updateable, and therefore does not cause "#Delete" errors.
- Avoid storing Null values within any field making up the unique index of your linked ODBC table.
Steps to Reproduce Behavior
- Open the sample database Northwind.mdb (or NWIND.MDB. in Microsoft Access 2.0)
- 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.
- 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.
- Press TAB to move to a new record. Note that the "#Deleted" error fills the record you entered.
- Close and re-open the table. Note that the record is correct.
ID članka: 128809 – Zadnji pregled: 18. jan. 2007 – Revizija: 1