Set Lock Type to adLockOptimistic : Lock « Access « VBA / Excel / Access / Word






Set Lock Type to adLockOptimistic

 
Sub SupportsMethod()
    'Declare and instantiate a Recordset object
    Dim rst As ADODB.Recordset
    Set rst = New ADODB.Recordset
    
    rst.ActiveConnection = CurrentProject.Connection
    rst.CursorType = adOpenStatic
    rst.LockType = adLockOptimistic
    rst.CursorLocation = adUseServer

    'Open the recordset, designating that the source
    'is a SQL statement
    rst.Open Source:="Select * from Employees ", _
        Options:=adCmdText

    'Determine whether the recordset supports certain features
    Debug.Print "Bookmark " & rst.Supports(adBookmark)
    Debug.Print "Update Batch " & rst.Supports(adUpdateBatch)
    Debug.Print "Move Previous " & rst.Supports(adMovePrevious)
    Debug.Print "Seek " & rst.Supports(adSeek)
    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.Configuration of LockType as a Property of the Recordset Object