Online Book Reader

Home Category

Access Cookbook - Ken Getz [206]

By Root 2052 0
and the salespeople also need to make updates to their own copies of the database. Is there any way to let everyone make updates and synchronize these copies when a salesperson returns to the office and plugs into the network?

Solution


Access 95 introduced a powerful feature called replication, which allows you to keep multiple copies of the same database synchronized. Subsequent versions of Access have continued to improve on replication. In this solution, we discuss how to set up a database for replication, how to synchronize the replicas, and how to deal with synchronization conflicts.

WARNING

Although it's easy to implement, it's difficult to undo the effects of replication. We recommend that you create a copy of your database and work with that copy while learning about replication. Do not experiment with a production database until you are ready to handle any problems that may arise.

Replicating a database


The steps for replicating a database using the Access menus are as follows:

Back up the database and safely store the backup.

Select Tools → Replication... → Create Replica. A dialog will appear informing you that the database must be closed before you can create a replica and that the database will increase in size. Choose Yes to proceed. A second dialog will ask you if you want to make a backup of the database before replicating it. Choose Yes if you didn't make a backup in Step 1, or No if you did. If you choose Yes, a backup of your database will be made with the .BAK extension. For example, the sample database 10-02.MDB will be backed up to 10-02.BAK.

You will then be prompted for the location of a replica. Access will create a design master replica, which takes the name of your original database, and a second replica of the design master, the name and location of which this dialog prompts for. You will end up with two identical databases. The dialog shown in Figure 10-10 is displayed on completion of the creation of the replicas, to inform you of the name and location of both the design master and the replica.

Figure 10-10. The create replica progress dialog

Once you click OK, the replication process is complete, and you will see the database container of the design master replica of the original database, as shown in Figure 10-11.

Figure 10-11. The database container of the replicated 10-02 database

You can create additional replicas by opening an existing replica and selecting Tools → Replication... → Create Replica. Access allows you to create additional replicas from any member of the replica set. However, you can make design changes only in the design master replica.

Distribute the replicas to the salespeople's laptops. Do not copy replicas to multiple machines using DOS or the Windows Explorer. You must create an additional unique replica for each user who will be using the replicated database by choosing Tools → Replication... → Create Replica from the menu and specifying each laptop as the destination.

Synchronizing replicas


Replicas in a replica set remain independent of each other until you choose to synchronize them. You can synchronize only replicas that are members of the same replica set; that is, only copies derived from the same design master. You synchronize replicas a pair at a time. When you are ready to synchronize a pair of replicas—for example, when a salesperson returns to the office and plugs his laptop into the office network—follow these steps:

Start Access and open any of the replicas in the replica set.

Select Tools → Replication... → Synchronize Now.

Using the drop-down box, select the database with which you wish to synchronize (see Figure 10-12). If you don't see the replica you want to synchronize with, someone has probably moved it, so you'll need to navigate to it using the Browse button. Once you have located the replica, press OK to start the synchronization process.

Figure 10-12. The Synchronize Database dialog

A progress dialog will appear. If the synchronization process completed successfully, a dialog

Return Main Page Previous Page Next Page

®Online Book Reader