Microsoft Jet and Replication Objects

CreateReplica Method

    Example    Applies To

Creates a new replica of the current replicable database.

Syntax

Replica.CreateReplica(ReplicaName, Description [, ReplicaType] [, Visibility]
   [, Priority] [, Updatability])

Parameters

ReplicaName   A String value specifying the name and path of the full or partial replica to be created. An error will occur when specifying a name longer than 255 characters.

Description   A String value describing the replica to be created.

ReplicaType   Optional. An Enum value indicating the type of replica to be created. The default value is jrRepTypeFull. See the ReplicaType property for more information. The following constants are valid values for ReplicaType:

Constant Description
JrRepTypeFull The replica is a full replica.
JrRepTypePartial The replica is a partial replica.

Visibility   Optional. An Enum value indicating the replica's visibility. The default value is jrRepVisibilityGlobal. See the Visibility property for more information. The following constants are valid values for Visibility:

Constant Description
JrRepVisibilityGlobal The replica is global.
JrRepVisibilityLocal The replica is local.
JrRepVisibilityAnon The replica is anonymous.

Priority   Optional. A Long value indicating the priority of the replica for use during conflict resolution. The default value is -1, which indicates that the database should determine the default value. For global replicas, the default priority is 90 percent of the parent replica's priority. Also, the valid values for a global replica may be further restricted. If the user is the database administrator, the entire range is valid. Otherwise, the maximum value for priority is 90 percent of the parent replica's priority. For local and anonymous replicas, the value will always be 0 and cannot be changed. This value is forced with the creation of the replica and any other value is ignored. See the Priority property for more information.

Updatability   Optional. An Enum value indicating the type of updates allowed. The default value is jrRepUpdFull. The constant jrRepUpdReadOnly prevents users from modifying schema and records of replicable objects of the new replica; however, when you synchronize the new replica with another member of the replica set, design and data changes will be propagated to the new replica. The following constants are valid values for Updatability:

Constant Description
jrRepUpdFull The replica can be updated.
jrRepUpdReadOnly The replica is read-only.

Remarks

An error will occur if the replica was not successfully opened and the ActiveConnection property is not set.

This method can only be used if the database is replicable. An error will occur if the ReplicaType is jrRepTypeNotReplicable and the user attempts to use this method.

A replica either inherits the exact same characteristics or is more restrictive than the replica that created it. For example, a read-only global replica can only create either a local or anonymous read-only replica, while a local replica can only create another local replica with the same characteristics.