Results 1 to 3 of 3

Thread: Problems with MoveLast and Move Previous statements

  1. #1

    Thread Starter
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    When you create your Recordset you're not spcifying what type of Cursor to Create.
    The Default is adOpenForwardOnly which is a Single Pass, (One Way Only), Read Only Cursor.
    Therefore the MoveFirst, MoveLast and MovePrevious Methods won't work.

    It's primarily used for Lookups requiring ReadOnly Data, because it's so much faster.

    Try Specifying adOpenKeySet instead.

    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]


    [This message has been edited by Aaron Young (edited 11-19-1999).]

  2. #2
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    Well, I did what you suggested but it didn't solve the problem, it only changed the error messages that I received. MoveFirst works fine. MoveLast now gave me a message that said "Errors occured" (Error -2147217887 (80040e21)). MovePrevious now gave me a message that said "Either BOF or EOF is True, or the current record has been deleted; the operation requested by the application requires a current record" (Error 3021). Also, when I just use <recordset>.movenext it will move to the second record in the table, but it won't go any further than that. Do you HAVE to close the recordset at the end of each sub function? Or is there some way to keep it open. Because the way it's set up right now, each time you execute one of the procedures, it starts the recordset anew. I think that might be part of the problem, but every time I try to take out the <recordset>.close command, it gives me errors.

    ------------------
    Ryan
    [email protected]
    ICQ# 47799046

  3. #3
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    For some reason I keep getting errors when I use the MoveLast and MovePrevious. When I use MoveLast, I get an error that says "The rowset does not support fetching backwards." (Error -2147217884 (80040e24)) And when I use MovePrevious I get an error that says "The operation requested by the application is not allowed in this context." (Error 3219). I have looked in the MSDN but not found anything except a page that tells me the error codes, but no way to fix them. I don't know what the problem is, please help. Here is my code.

    Source = "SELECT * FROM Customers"
    Connect = "DSN=CPCustomDB; UID=DBA; PWD=SQL;"

    Rs.Open Source, Connect
    Rs.MovePrevious

    Rs.Close
    Set Rs = Nothing

    AND:

    Source = "SELECT * FROM Customers"
    Connect = "DSN=CPCustomDB; UID=DBA; PWD=SQL;"

    Rs.Open Source, Connect
    Rs.MoveLast

    Rs.Close
    Set Rs = Nothing



    ------------------
    Ryan
    [email protected]
    ICQ# 47799046

Posting Permissions

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



Click Here to Expand Forum to Full Width