ACC: Cascade Deletes May Cause Err Msg in Synchronized ReplicaLast reviewed: May 23, 1997Article ID: Q158934 |
The information in this article applies to:
SYMPTOMSModerate: Requires basic macro, coding, and interoperability skills. When you open a database after synchronizing it with another member of the replica set, you see a replication data error because an Insert operation failed due to referential integrity violations. You see one of the following errors:
In Microsoft Access 97
You can't add or change a record because a related record is required in table '<tablename>'. In Microsoft Access 7.0
Can't add or change record. Referential integrity rules require a related record in table '<tablename>'.When you try to correct the error, the conflicting record does not exist.
CAUSEThe following events occurred:
RESOLUTIONIf the relationship between primary and related tables enforces cascading deletes, then the next time you synchronize the two databases, the error will resolve itself.
MORE INFORMATIONWhen you create a relationship that enforces cascading deletes, all records from the many-side table in the relationship are deleted when you delete the related record from the one-side table. However, with replicated databases, it is possible to add a new record in one database after its related record in the primary table has been deleted from another database. When this happens, it may take two synchronization events to delete the records from both databases and clear the replication errors that occur. For example, you have two databases in a replica set: a Design Master and a Replica. The databases have a one-to-many relationship between the Customers and Orders tables. The relationship enforces cascading deletes. You delete a customer from the Design Master, and all orders for that customer are deleted as well. At the same time, someone adds an order for that customer in the Replica database. The result when these two databases are synchronized differs depending on which database starts the synchronization.
Design Master Synchronizes with ReplicaWhen the Design Master starts synchronization with the Replica, it sends its changes to the Replica first. The customer and all related orders were deleted from the Design Master, so the customer and all related orders are deleted from the Replica, including the new order that was added to the Replica. The result is that no replication data errors occur because the order was deleted from the Replica before it could be added to the Design Master.
Replica Synchronizes with Design MasterWhen the Replica starts synchronization with the Design Master, it sends its changes to the Design Master first. The Replica tries to insert a new order in the Design Master, but since the related customer record was deleted from the Design Master, a referential integrity error is entered in the MSysErrors system table in both databases. Then the Design Master sends its updates to the Replica, and the customer and all related orders are deleted from the Replica, including the order that caused the referential integrity error. The result is that both the Design Master and the Replica are fully synchronized, but there is a referential integrity error that you see the next time you open either database. If you synchronize again, the error is automatically removed because the record that caused the error no longer exists.
Steps to Reproduce BehaviorCreating the Replica Set:
REFERENCESFor more information about referential integrity and the relationships between tables, search the Help Index for "referential integrity," or ask the Microsoft Access 97 Office Assistant. For more information about obtaining a copy of the Microsoft Jet Database Replication white paper, which contains more information about replication features in Microsoft Access, please see the following articles here in the Microsoft Knowledge Base:
ARTICLE-ID: Q164553 TITLE : ACC97: Jet 3.5 Replication White Paper Available on MSL ARTICLE-ID: Q138828 TITLE : ACC95: Microsoft Jet Replication White Paper Available on MSL |
Keywords : kberrmsg kbusage RltRef RplConf
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |