Access Cookbook - Ken Getz [207]
Resolving conflicts
If multiple users have made updates to the same record in different replicas, one or more users will be informed of conflicts when they close and reopen the database to complete synchronization. See Recipe 10.2.3 of this solution for more details on how Access determines which change "wins" a synchronization conflict.
If one or more of your edits "loses" in the exchange, you will see a dialog the next time you open the database, stating "This member of the replica set has conflicts from synchronizing changes with other members. Do you want to resolve conflicts now?" To resolve the conflicts, follow these steps:
Choose Yes at the conflict dialog to start the resolution process.
A second dialog will appear, summarizing the conflicts that have occurred (see Figure 10-13). Select a table in the list box and press the View button to see the conflicts for that table.
Figure 10-13. The Microsoft Replication Conflict Viewer dialog
After a brief delay, a conflict resolution form will appear for the table. A conflict resolution form for the tblCustomer table is shown in Figure 10-14.
Figure 10-14. A conflict resolution form for tblCustomer
For each conflict record, the conflict winner will appear on the lefthand side of the form and the conflict loser will appear on the right. Pick the version of the record that you feel is more "correct." If you'd like, you can edit one version, combining data from both versions or some third source of information. To resolve the conflicting record, press either the Keep Winning Change button, or the Resolve With This Data button. If you want to resolve the conflict later, choose the Postpone Resolution button. Repeat the process for each record in the conflict table.
Close the form and repeat Steps 2-4 for any remaining tables.
You will then need to propagate the changes to all the other replicas in the replica set by choosing Tools → Replication... → Synchronize Now.
Discussion
To summarize, when you replicate a database in Access, you change the database structure so that Access can track changes made to the database and later synchronize those changes with other copies of the database. Copies of a replicated database are called replicas; the original master copy is called the design master. You can make design changes only to the design master. The design master and its replicas make up a replica set. You can synchronize only members of a replica set.
When converting a nonreplicated database to a replicated one, Access makes the following changes:
Adds additional tables to track changes
Adds additional fields to each table to ensure uniqueness of records across replicas and to track changes
Adds new properties to the database
Changes any sequentially assigned AutoNumber fields to randomly assigned AutoNumber fields to reduce the possibility of AutoNumber conflicts
When you synchronize replicas, Access compares records in each replica using the hidden s_Generation field to determine if records have been updated. During synchronization, only changed rows are exchanged between replicas.
When conflicting edits are detected during a synchronization exchange, Access determines which edited version of a record "wins" an exchange using the following rules:
If a record in one replica was changed more times than in the other replicas, it wins.
If all copies of a record were changed an equal number of times, Access randomly picks a winner.
Only users with "losing" edits are notified of conflicts.
Replication works best when your replicas are only loosely coupled, and it isn't critical that all changes be synchronized as soon as they are made. It is best to replicate only tables, and not forms, reports, or other Access objects. Although Access supports replicating other database objects, it doesn't always work well. You may find that in attempting