recordsetclone movenext wont move

cpampas

Registered User.
Local time
Yesterday, 21:41
Joined
Jul 23, 2012
Messages
221
Any ideas as to why the .moveNext method does not move to next record, it always stays in the first one

Code:
Dim db As Database
Dim rst As Recordset

Set db = CurrentDb()
Set rst = Me.RecordsetClone

With rst
  Do While Not .EOF
   
     Debug.Print Me.anoMaq  ' always the first record
   
   .MoveNext
Loop
End With

the subform data is from a query (qryBuscaB), so I also tried :
Set rst = db.OpenRecordset("qryBuscaB", dbOpenDynaset)

but the same problem persists
Thanks for your help
 
Maybe there is only one record in the recordset? What do you get if you open the query?
 
CronK, Thanks for your reply
Anyway it was my fault, i didnt notice the wrong syntax
I had : Debug.Print Me.anoMaq
I should : Debug.Print !anoMaq
 
Yes. You were printing the record bound to the form rather than from the recordset.

I would add that performing operations on the recordset bound to the form is a poor practice. If you want to perform a batch operation on a recordset, do it with a query from a place other than the form bound to the records you want to update.
 

Users who are viewing this thread

Back
Top Bottom