Making Additional Replicas

Although changes to the design of the database can be made only in the Design Master, additional replicas can be made from any member of the set. In fact, the only way for new copies of the database to be included in the replica set is for them to be created from an existing member. Once created, all new replicas become part of the replica set. All the members of a replica set have a unique identity and can communicate and synchronize with one another. Each replica set is independent from all other replica sets, and replicas in different sets cannot communicate or synchronize with each other.

Important Never try to make additional replicas from the original, nonreplicable database. The result would not be an additional replica, but rather a new replicable Design Master database and replica set.

When you convert your database by setting its ReplicableBool property to True, you have only one member (the Design Master) in the replica set. You can make your first replica, and subsequent replicas, by using the MakeReplica method. For example, to make a replica, you can use the following code:

Sub MakeAdditionalReplica(strReplicableDB As String, strNewReplica As String)
	Dim dbs As Database
	
	' Open a replica in replica set.
	Set dbs = OpenDatabase(strReplicableDB)
	' Make new read-only replica.
	dbs.MakeReplica strNewReplica, " Replica of " & _
		strReplicableDB, dbRepMakeReadOnly
	dbs.Close
End Sub

Note that the value passed for the description argument of the MakeReplica method shows up only in Microsoft Replication Manager. It is not available anywhere else.

If you include the dbRepMakeReadOnly constant, the replicable elements of the newly created replica cannot be modified. Otherwise, users will be able to make changes to the data in the new replica. As Microsoft Jet creates the new replica, all data definition language property settings of the source replica are included in the new replica. You can make subsequent replicas from either the Design Master or any full replica in the set. If you attempt to create a subsequent replica from a partial replica, an error occurs.

When you are using the MakeReplica method, make sure that the objects you are replicating are not locked, or the method will fail. Microsoft Jet locks objects while they are open in design mode or being updated during a synchronization. Programmers might easily overlook this requirement and attempt to make a replica from the database that has locked objects.

Note When you make a new replica, you copy all of the replicable objects and properties from the source replica to the new replica. Although you copy all linked tables, the path to a linked table might no longer be accurate because of the new replica’s location on the network. Be sure to test the new replica to determine if you need to establish a new path for any of the linked tables.