vba recodeset update (Excel)
I use the following to update a recordset field value if it's found to be Null. When processing
the Update statement, I get the following error.
"Row cannot be located for updating" Some values may have been updated since last read.
My code...
Set rsset = New ADODB.Recordset
rsSet.CursorType = adOpenStatic
rsEdit.LockType = adLockOptimistic
rsEdit.Open "SELECT * FROM Customers"
rsSet.Movefirst
While not rsSet.EOF
If isnull(rsSet("Divide") = True then
rsSet.fields("Divide") = 8844
rsSet.fields("Codename") = "NoName"
rsSet.Update ' >>>>>>>>> I get the above error at this step!!
rsEdit.MoveFirst
End if
Wend
Just before the update statement. I perform a debug.print rsSet.fields("Divide"), rsSet.fields("Codename")
to find that the values have been changed to the new value 8844 & NoName respectively.
Updating & advancing to the next record seems to be a problem.
Any suggestions for resolving my update issue?
|