Database.MakeReplica method (DAO)

Applies to: Access 2013, Office 2013

Makes a new replica from another database replica (Microsoft Access workspaces only).

Syntax

expression .MakeReplica(PathName, Description, Options)

expression A variable that represents a Database object.

Parameters

Name

Required/optional

Data type

Description

PathName

Required

String

The path and file name of the new replica. If replica is an existing file name, then an error occurs.

Description

Required

String

A String that describes the replica that you are creating

Options

Optional

Variant

A ReplicaTypeEnum constant that specifies characteristics of the replica you are creating.

Remarks

A newly created partial replica will have all ReplicaFilter properties set to False, meaning that no data will be in the tables.

Example

This function uses the MakeReplica method to create an additional replica of an existing Design Master. The intOptions argument can be a combination of the constants dbRepMakeReadOnly and dbRepMakePartial, or it can be 0. For example, to create a read-only partial replica, you should pass the value dbRepMakeReadOnly + dbRepMakePartial as the value of intOptions.

Function MakeAdditionalReplica(strReplicableDB As _ 
 String, strNewReplica As String, intOptions As _ 
 Integer) As Integer 
 
 Dim dbsTemp As Database 
 On Error GoTo ErrorHandler 
 
 Set dbsTemp = 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 
 dbsTemp.MakeReplica strNewReplica, _ 
 "Replica of " & strReplicableDB 
 Else 
 dbsTemp.MakeReplica strNewReplica, _ 
 "Replica of " & strReplicableDB, _ 
 intOptions 
 End If 
 
 dbsTemp.Close 
 
ErrorHandler: 
 Select Case Err 
 Case 0: 
 MakeAdditionalReplica = 0 
 Exit Function 
 Case Else: 
 MsgBox "Error " & Err & " : " & Error 
 MakeAdditionalReplica = Err 
 Exit Function 
 End Select 
 
End Function