ConflictTable Property

Applies To   TableDef object.

Description

Returns the name of a conflict table containing the database records that conflicted during the synchronization of two replicas (Microsoft Jet workspaces only).

Return Values

The return value is a String data type that is a zero-length string if there is no conflict table or the database isn't a replica.

Remarks

If two users at two separate replicas each make a change to the same record in the database, the changes made by one user will fail to be applied to the other replica. Consequently, the user with the failed change must resolve the conflicts.

Conflicts occur at the record level, not between fields. For example, if one user changes the Address field and another updates the Phone field in the same record, then one change is rejected. Because conflicts occur at the record level, the rejection occurs even though the successful change and the rejected change are unlikely to result in a true conflict of information.

The synchronization mechanism handles the record conflicts by creating conflict tables, which contain the information that would have been placed in the table, if the change had been successful. You can examine these conflict tables and work through them row by row, fixing whatever is appropriate.

All conflict tables are named table_conflict, where table is the original name of the table, truncated to the maximum table name length.

See Also   Synchronize method.

Example

This example uses the ConflictTable property to report the table names that had conflicts during synchronization.

Sub ConflictTableX()

    Dim dbsNorthwind As Database
    Dim tdfTest As TableDef

    Set dbsNorthwind = OpenDatabase("Northwind.mdb")

    ' Enumerate TableDefs collection and check ConflictTable
    ' property of each.
    For Each tdfTest In dbsNorthwind.TableDefs
        If tdfTest.ConflictTable <> "" Then _
            Debug.Print tdfTest.Name & " had a conflict."
    Next tdfTest

    dbsNorthwind.Close

End Sub
This example opens a Recordset from the conflict table and one from the table that caused the conflict. It then processes the records in these tables, using the RequiredDate field to copy information from one table to the other depending on which record was more recently updated.

Sub ConflictTableX2(dbsResolve As Database)

    Dim tdfTest As TableDef
    Dim rstSource As Recordset
    Dim rstConflict As Recordset
    Dim fldLoop As Field

    Set tdfTest = dbsResolve.TableDefs("Orders")

    If tdfTest.ConflictTable <> "" Then

        Set rstSource = dbsResolve.OpenRecordset( _
            tdfTest.Name, dbOpenTable)
        Set rstConflict = dbsResolve.OpenRecordset( _
            tdfTest.ConflictTable, dbOpenTable)
        rstSource.Index = "[d_Guid]"
        rstConflict.MoveFirst
        Do Until rstConflict.EOF
            rstSource.Seek "=", rstConflict![s_Guid]
            If Not rstSource.NoMatch Then
                If rstSource!RequiredDate < _
                        rstConflict!RequiredDate Then
                    On Error Resume Next
                        For Each fldLoop in rstConflict.Fields
                            fldLoop = rstSource(fldLoop.Name)
                        Next fldLoop
                    On Error Goto 0
                End If
            End If
            rstConflict.Delete
            rstConflict.MoveNext
        Loop

        rstConflict.Close
        rstSource.Close
    End If

End Sub