Access.2007.VBA.Bibl..

(John Hannent) #1
rst.CursorType = adOpenStatic, “Static (“ _
& adOpenStatic & “)”)

strLockType = Switch(rst.LockType = _
adLockOptimistic, _
“Optimistic (“ & adLockOptimistic & “)”, _
rst.LockType = adLockReadOnly, “Read-only (“ _
& adLockReadOnly & “)”, _
rst.LockType = adLockBatchOptimistic, _
“BatchOptimistic (“ _
& adLockBatchOptimistic & “)”, _
rst.LockType = adLockPessimistic, _
“Pessimistic (“ _
& adLockPessimistic & “)”)

Debug.Print “Recordset cursor/lock type: “ _
& strCursorType & “, “ & strLockType & vbCrLf
Debug.Print “AddNew supported? “ _
& rst.Supports(adAddNew)
Debug.Print “Delete supported? “ _
& rst.Supports(adDelete)
Debug.Print “Find supported? “ _
& rst.Supports(adFind)
Debug.Print “MovePrevious supported? “ _
& rst.Supports(adMovePrevious)
Debug.Print “Update supported? “ _
& rst.Supports(adUpdate)

ErrorHandlerExit:

Close the Recordset and Connection objects.
If Not rst Is Nothing Then
If rst.State = adStateOpen Then
rst.Close
Set rst = Nothing
End If
End If

If Not cnn Is Nothing Then
If cnn.State = adStateOpen Then
cnn.Close
Set cnn = Nothing
End If
End If

Exit Sub

Part II Writing VBA Code to Exchange Data between Office Components

Free download pdf