467,076 Members | 995 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,076 developers. It's quick & easy.

error: Row cannot be located for updating. Some value may have been changes since...

Hi all...

I want to delete the data that over 5years. But my code has such error:
"vb6 error: Row cannot be located for updating. Some value may have been changed since it was last read."

And my code is:
Expand|Select|Wrap|Line Numbers
  1. If IsNull(rs.Fields("dateVar")) Then
  2.     GoTo nextStep
  3.     Else
  4.  
  5.     rs.MoveFirst
  6.     Do While (rs.EOF <> True)
  7.         If (DateDiff("yyyy", rs.Fields("dateVar"), Now()) >= 5) Then
  8.                rs.delete
  9.         End If
  10.         rs.Update
  11.         rs.MoveNext
  12.     Loop
  13.  
  14. End If
The error is pointed to the row: rs.delete..

Please help me... I have struggling to this problem many days...
Jul 3 '07 #1
  • viewed: 4384
Share:
2 Replies
Expert 8TB
Um... not too sure about this one, but could you try removing the Update and the MoveNext?
Jul 3 '07 #2
Expert 8TB
Um... not too sure about this one, but could you try removing the Update and the MoveNext?
Oops! I mean instead of doing Update and MoveNext every time, make it
If ...
Delete
Else
MoveNext
End If

and remove the Update.
Jul 3 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

11 posts views Thread by Jason | last post: by
5 posts views Thread by hpy_awad@yahoo.com | last post: by
669 posts views Thread by Xah Lee | last post: by
5 posts views Thread by berry | last post: by
3 posts views Thread by Jim Armstrong | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.