Configuration of LockType as a Property of the Recordset Object : Lock « Access « VBA / Excel / Access / Word






Configuration of LockType as a Property of the Recordset Object

 
Sub OptimisticRecordset()
    Dim rst As ADODB.Recordset
    Set rst = New ADODB.Recordset

    rst.ActiveConnection = CurrentProject.Connection
    rst.CursorType = adOpenStatic
    rst.LockType = adLockOptimistic

    rst.Open "Select * from Employees"

    rst("City") = "Village"
    rst.Update
    Debug.Print rst("City")

    rst.Close
    Set rst = Nothing

End Sub

 








Related examples in the same category

1.Use Row Level Locking
2.Default Record Locking
3.Set and get the lock type
4.use optimictic lock to open recordset
5.Set Lock Type to adLockOptimistic