Resync Method

Refreshes the data in the current Recordset object, or Fields collection of a Record object, from the underlying database.


Recordset.Resync AffectRecords, ResyncValues Record.Fields.Resync ResyncValues

AffectRecords

Optional. An AffectEnum value that determines how many records the Resync method will affect. The default value is adAffectAll. This value is not available with the Resync method of the Fields collection of a Record object.

ResyncValues

Optional. A ResyncEnum value that specifies whether underlying values are overwritten. The default value is adResyncAllValues.

Recordset

Use the Resync method to resynchronize records in the current Recordset with the underlying database. This is useful if you are using either a static or forward-only cursor, but you want to see any changes in the underlying database.

If you set the CursorLocation property to adUseClient, Resync is only available for non-read-only Recordset objects.

Unlike the Requery method, the Resync method does not re-execute the Recordset object's underlying command. New records in the underlying database will not be visible.

If the attempt to resynchronize fails because of a conflict with the underlying data (for example, a record has been deleted by another user), the provider returns warnings to the Errors collection and a run-time error occurs. Use the Filter property (adFilterConflictingRecords) and the Status property to locate records with conflicts.

If the Unique Table and Resync Command dynamic properties are set, and the Recordset is the result of executing a JOIN operation on multiple tables, then the Resync method will execute the command given in the Resync Command property only on the table named in the Unique Table property.

Fields

Use the Resync method to resynchronize the values of the Fields collection of a Record object with the underlying data source. The Count property is not affected by this method.

If ResyncValues is set to adResyncAllValues (the default value), the UnderlyingValue, Value, and OriginalValue properties of Field objects in the collection are synchronized. If ResyncValues is set to adResyncUnderlyingValues, only the UnderlyingValue property is synchronized.

The value of the Status property for each Field object at the time of the call also affects the behavior of Resync. For Field objects that have Status values of adFieldPendingUnknown or adFieldPendingInsert, Resync has no effect. For Status values of adFieldPendingChange or adFieldPendingDelete, Resync synchronizes data values for fields that still exist at the data source.

Resync will not modify Status values of Field objects unless an error occurs when Resync is called. For example, if the field no longer exists, the provider will return an appropriate Status value for the Field object, such as adFieldDoesNotExist. Returned Status values can be logically combined within the value of the Status property.

Show:
© 2014 Microsoft