Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, I have an error. When i execut

Status
Not open for further replies.

simran1

Programmer
Apr 23, 2002
82
US
Hi,
I have an error. When i execute the following code, i get the error at the stmt, ars.Update.
Run time error '-2147217864 (80040e38)'
Row cannot be located for updating. Some values may have changed since it was last read.

But when i am trying to debug this code, i do not get any errors.

Code:
aSQL = "SELECT Status.* FROM  "
aSQL = aSQL & " Status  LEFT JOIN Items ON  "
aSQL = aSQL & " Status.ItemID = Items.ID  WHERE "
aSQL = aSQL & " Status.LoginID= " & UserID
aSQL = aSQL & " AND Items.Category = " & Header
aRS.CursorLocation = adUseClient
aRS.Open aSQL, DSN, adOpenDynamic, adLockOptimistic  
Do While Not aRS.EOF()
   aRS.Fields("Status") = Stat
   aRS.Update
   aRS.MoveNext
Loop
aRS.Close

What is this?
I appreciate the time taken to help me out.
 
Try deleting the aRS.Update Line all together. ADO updates the edited record when you move to a new record, which you do with the aRS.MoveNext in the following line. Let me know if this helps. If you choose to battle wits with the witless be prepared to lose.
[machinegun][hammer]

[cheers]
 
Hi,
I still get the error. Now I get it at the next stmt, i.e., at ars.MoveNext
 
You might try putting a .MoveFirst immediately after opening the Recordset.
Code:
aRS.Open aSQL, DSN, adOpenDynamic, adLockOptimistic  
aRS.MoveFirst
Do While Not aRS.EOF()
Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top