Although you can make changes to the design of the database only in the Design Master replica, you can make additional replicas from any replica in the set. In fact, the only way to include new copies of the database in the replica set is to create them from an existing replica. Once you create them, all new replicas become part of the replica set.
All the replicas in 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, nonreplicated database. The result would not be an additional replica, but rather a new Design Master and replica set.
When you convert your database to a Design Master by setting its ReplicableBool property to True, you have only one replica (the Design Master) in the replica set, and you make your second replica from the first. You can make your second replica, and subsequent replicas, by using the Create Replica command (Tools menu, Replication submenu) in Microsoft Access, or by using the MakeReplica method in code. For example, to make a replica of your database, you can use the following code:
Function MakeAdditionalReplica(strReplicableDB As String, _
strNewReplica As String, intOptions As Integer) As Boolean
Dim dbs As Database
On Error GoTo ErrorHandler
Set dbs = OpenDatabase(strReplicableDB)
' If no options are passed to MakeAdditionalReplica, omit the options
' argument, which defaults to a full, read/write replica. Otherwise,
' use the value of intOptions.
If intOptions = 0 Then
dbs.MakeReplica strNewReplica, "Replica of " & strReplicableDB
Else
dbs.MakeReplica strNewReplica, "Replica of " & strReplicableDB, intOptions
End If
dbs.Close
ErrorHandler:
Select Case Err
Case 0:
MakeAdditionalReplica = True
Exit Function
Case Else: MsgBox "Error " & Err & " : " & Error
MakeAdditionalReplica = False
Exit Function
End Select
End Function
If you specify the dbRepMakeReadOnly constant in the options argument of the MakeReplica method, then the objects in the newly created replica cannot be modified. Otherwise, users are able to make changes to the data in the new replica. If you specify the dbRepMakePartial constant in the options argument of the MakeReplica method, you create a partial replica rather than a full replica.
See Also For more information on partial replicas, see “Replicating Part of a Database” later in this chapter.
When Microsoft Jet creates the new replica, all property settings of the source replica except custom property settings are included in the new replica. You can make subsequent replicas from either the Design Master replica or from another replica in the set.
Microsoft Jet locks objects while they are open in Design view or while their data is being updated. When you use the MakeReplica method, be sure that the objects you are replicating aren’t locked. If objects are locked when you make a replica, the MakeReplica method fails.
Note When you make a new replica, you copy all of the objects and properties that can be replicated from the source replica to the new replica. Although you copy all linked tables, the path to a linked table may 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. You can change the path specified in the connection string of the Connect property for a linked table even though modifying the connection information is a design change. All other design changes must be made in the Design Master.
With database replication, it’s no longer necessary to make a separate backup copy of your database. If the Design Master is destroyed, you can recover your data from any one of the replicas in the replica set. However, depending on how frequently you synchronize, a replica may not contain all the data in the Design Master or in other replicas. If you want to be able to recover most of the information in your Design Master, be sure to synchronize frequently.
Although it’s possible to back up replicas by using traditional backup methods, it’s strongly advised not to back up and restore replicas as you would ordinary files. If you back up and restore the Design Master, you could lose critical information about changes to the design of the database as well as the ability of the Design Master to synchronize with the other replicas in the set. If the Design Master is damaged or unusable, don’t copy or restore an older version of the Design Master; instead, make another replica the Design Master.