Thursday, September 23, 2010

ADO UpdateBatch Method

ADO UpdateBatch Method

The UpdateBatch method is used to save all changes in a Recordset to the database. This method is used when you are working on a Recordset in batch update mode.
If the save operation fails, a run-time error occurs and the errors are stored in the Errors collection.

E.g.

With rs

.ActiveConnection = CurrentProject.Connection
.Source = "Data Base Name"
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.LockType = adLockBatchOptimistic
.Open

Dim counter As Long

For counter = 0 To .RecordCount - 1
.Addnew
.MoveNext
Next

.UpdateBatch

rowsDel = counter

End With

No comments:

Post a Comment