ReplicaFilter Property Example

The following example uses the ReplicaFilter property to replicate only customer records from the California region.

Sub ReplicaFilterX()

    ' This example assumes the current open database
    ' is the replica.
    Dim tdfCustomers As TableDef
    Dim strFilter As String
    Dim dbsTemp As Database

    Set dbsTemp = OpenDatabase("Northwind.mdb")
    Set tdfCustomers = dbsTemp.TableDefs("Customers")

    ' Synchronize with full replica
    ' before setting replica filter.
    dbsTemp.Synchronize "C:\SALES\FY96.MDB"

    strFilter = "Region = 'CA'"
    tdfCustomers.ReplicaFilter = strFilter
    dbsTemp.PopulatePartial "C:\SALES\FY96.MDB"

    ' Now remove the replica filter (for example purposes
    ' only).
    tdfCustomers.ReplicaFilter = False
    ' Repopulate the database.
    dbsTemp.PopulatePartial "C:\SALES\DATA96.MDB"

End Sub