PDA

Click to See Complete Forum and Search --> : Problems with MoveLast and Move Previous statements


Aaron Young
Nov 19th, 1999, 01:18 AM
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
aarony@redwingsoftware.com
adyoung@win.bright.net


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

Gimpster
Nov 19th, 1999, 01:58 AM
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
corneslen@hotmail.com
ICQ# 47799046

Gimpster
Nov 19th, 1999, 11:43 AM
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
corneslen@hotmail.com
ICQ# 47799046