Replicable Property

Applies To   Database object, Document object, QueryDef object, TableDef object.

Description

Sets or returns a value that determines whether a database or object in a database can be replicated (Microsoft Jet workspaces only).

Note Before getting or setting the Replicable property on a Database, TableDef, or QueryDef object, you must create it by using the CreateProperty method and append it to the Properties collection for the object.

Setting and Return Values

The setting or return value is a Text data type.

On a Database object, setting this property to "T" makes the database replicable. Once you set the property to "T", you can't change it; setting the property to "F" (or any value other than "T") causes an error.

On an object in a database, setting this property to "T" replicates the object (and subsequent changes to the object) at all replicas in the replica set. You can also set this property in the object's property sheet in Microsoft Access.

Note   Microsoft Jet 3.5 also supports the Boolean ReplicableBool property. Its functionality is identical to the Replicable property, except that it takes a Boolean value. Setting ReplicableBool to True makes the object replicable.

Remarks

Before setting the Replicable property on a database, make a backup copy of the database. If setting the Replicable property fails, you should delete the partially replicated database, make a new copy from the backup, and try again.

When you set this property on a Database object, Microsoft Jet adds fields, tables, and properties to objects within the database. Microsoft Jet uses these fields, tables, and properties to synchronize database objects. For example, all existing tables have three new fields added to them that help identify which records have changed. The addition of these fields and other objects increase the size of your database.

On forms, reports, macros, and modules defined by a host application (such as Microsoft Access), you set this property on the host-defined object through the host user interface. Once set, the Replicable property will appear in the Properties collection for the Document object representing the host object.

If the Replicable property has already been set on an object using the Replicated check box in the property sheet for the object, you cannot set the Replicable property in code.

When you create a new table, query, form, report, macro, or module at a replica, the object is considered local and is stored only at that replica. If you want users at other replicas to be able to use the object, you must change it from local to replicable. Either create the object at or import it into the Design Master and then set the Replicable property to "T".

The object on which you are setting the Replicable property might have already inherited that property from another object. However, the value set by the other object has no effect on the behavior of the object you want to make replicable. You must explicitly set the property for each object.

See Also   CreateProperty method, KeepLocal property, MakeReplica method.

Example

These examples illustrate two situations for using the Replicable Property — on a database and on an object in the database.

This example makes Northwind.mdb a replicable database. It's recommended that you make a back-up copy of Northwind before running this code, and that you adjust the path to Northwind as appropriate to its location on your computer.

Sub MakeDesignMasterX()

    Dim dbsNorthwind As Database
    Dim prpNew As Property

    ' Open database for exclusive access.
    Set dbsNorthwind = OpenDatabase("Northwind.mdb", _
        True)

    With dbsNorthwind

        ' If Replicable property doesn't exist, create it.
        ' Turn off error handling in case property exists.
        On Error Resume Next
        Set prpNew = .CreateProperty("Replicable", _
            dbText, "T")
        .Properties.Append prpNew

        ' Set database Replicable property to True.
        .Properties("Replicable") = "T"

        .Close

    End With

End Sub
This example creates a new TableDef and then makes it replicable. The database must first be replicable for this procedure to work.

Sub CreateReplLocalTableX()

    Dim dbsNorthwind As Database
    Dim tdfNew As TableDef
    Dim fldNew As Field
    Dim prpNew As Property

    Set dbsNorthwind = OpenDatabase("Northwind.mdb")
    ' Create a new TableDef named "Taxes".
    Set tdfNew = dbsNorthwind.CreateTableDef("Taxes")
    ' Define a text field named "Grade".
    Set fldNew = tdfNew.CreateField("Grade", dbText, 3)
    ' Append new field to the TableDef.
    tdfNew.Fields.Append fldNew

    ' Add the new TableDef to the database.
    dbsNorthwind.TableDefs.Append tdfNew

    ' Create a new Replicable property for new TableDef.
    Set prpNew = tdfNew.CreateProperty("Replicable", _
        dbText, "T")
    ' Append the Replicable property to the new
    ' TableDef.
    tdfNew.Properties.Append prpNew
    dbsNorthwind.Close

End Sub
The following code sets the Replicable property on the specified TableDef object to "T". If the property does not exist, it is created and appended to the table's Properties collection, and given a value of "T".

Sub SetReplicable(tdfTemp As TableDef)

    On Error GoTo ErrHandler

    tdfTemp.Properties("Replicable") = "T"

    On Error GoTo 0

    Exit Sub

ErrHandler:

    Dim prpNew As Property

    If Err.Number = 3270 Then
        Set prpNew = tdfTemp.CreateProperty("Replicable", _
            dbText, "T")
        tdfTemp.Properties.Append prpNew
    Else
        MsgBox "Error " & Err & ": " & Error
    End If

End Sub