472,139 Members | 1,687 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,139 software developers and data experts.

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

46
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
2 4556
Killer42
8,435 Expert 8TB
Um... not too sure about this one, but could you try removing the Update and the MoveNext?
Jul 3 '07 #2
Killer42
8,435 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 | 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 Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.