Does anybody knows how to use recordset.moveprevious

shirley_kee

New member
Local time
Today, 11:48
Joined
Sep 15, 2006
Messages
6
Does anybody know how to use recordset.moveprevious?
I'm using Access 2000. I want to use moveprevious function but it generates an error. Following are my codes and I've attached the error screen. Thanks a lot...

Private Sub cmdPrev_Click()

If rstProceeds.BOF <> True Then
rstProceeds.Moveprevious
End If
End Sub


Below are my connection string
Set rstProceeds = New ADODB.Recordset
Set cmdProceeds = New ADODB.Command

sSQL = "SELECT * " & _
"FROM [AUC] " & _
"WHERE((([AUC]].[STATUS]) = ""SOLD"" "


cmdProceeds.CommandText = sSQL

cmdProceeds.CommandType = adCmdText
cmdProceeds.ActiveConnection = CurrentProject.Connection

If sSQL <> "" Then
Set rstProceeds = cmdProceeds.Execute
If rstProceeds.EOF <> True Then
Call GetAFData
End If

End If
 

Attachments

Where are you creating your ADO connection, and why aren't you just using the normal form recordsource? Then, you can just set the recordsource to your SQL string and then use Docmd.MovePrevious. Much simpler.

Also, don't double post (you posted the same question in the Macros area).
 
When you are using a query to create a recordsource, be aware that some modes of query are "forwards only." In which case a .moveprevious is not allowed. Since you didn't show where you opened the recordsource, I would say look there and see what mode you selected. Or if the default mode is one that blocks the .moveprevious, that would do it. Finally, if it is a connection to another type of database, the nature of that connection also governs whether backstepping is allowed.
 

Users who are viewing this thread

Back
Top Bottom