Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    283
    Thanks
    0
    Thanked 0 Times in 0 Posts

    cursor type in ADO (Access 2000)

    I would like to know in the following program

    Dim dbs As ADODB.Connection
    Dim rst As New ADODB.Recordset
    Set dbs = CurrentProject.Connection
    rst.Open "select * from box", dbs, adOpenForwardOnly, adLockOptimistic
    rst.MoveLast
    rst.MoveFirst

    if I have the cursor as forward only, then why the last statement (movefirst) will not cause an error?

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: cursor type in ADO (Access 2000)

    You request a CursorType, and the provider decides what type you actually get. When specifying adLockOptimistic, my sources indicate you get the following:

    <table border=1 bordercolor=black cellspacing=0 cellpadding=4 bgcolor=yellow><td>Provider</td><td>CursorLocation</td><td>LockType</td><td>Requested CursorType</td><td>Resulting CursorType</td><td>OLE DB for Jet</td><td>adUseServer</td><td>Optimistic</td><td>Forward-Only</td><td>Keyset</td><td>OLE DB for Jet</td><td>adUseClient</td><td>Optimistic</td><td>Forward-Only</td><td>Static</td><td>OLE DB for ODBC with Access</td><td>adUseServer</td><td>Optimistic</td><td>Forward-Only</td><td>Forward-Only</td><td>OLE DB for ODBC with Access</td><td>adUseClient</td><td>Optimistic</td><td>Forward-Only</td><td>Static</td></table>
    So, if you add a Stop statement immediately after the .Open call and check your Locals window under rst... what do you find?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •