How to use recordset to update data in table?

  • Thread starter Thread starter CK NG
  • Start date Start date
C

CK NG

Hi All,
I facing a problem by updating the table record. I am use DAO
recordset edit the table record. The problem I facing is: Let say the data I
want to update is in 10th row of the table. First i call recordset move
first to initiate, and the I use for loop to call recordset MoveNext 10
times to access the data row i wish to update. But the result is , not the
10th row data updated, but was the other row.
Can anyone tell me, what go wrong by using MoveNext? And how to
fix it. How I can update the particular row of data, in records, If you can
show me a line or two of codes how to do that. I will very appreciated.


Thanks.

Best Regards,
C.K.
 
There is no such thing as "the 10th row" in a DAO recordset. Oh, there is a
row number 10, but is may not always be the same record everytime the
recordset is opened. There is no intrinsic order to Access tables. You
really need to find some data in the row that uniquely identifies the row
you want, then use the FindFirst method to go there.

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
MoveFirst already has you on row one. So if you call MoveNext 10 times you
will be on row 11, not row 10. Calling MoveNext 9 times will put you on the
10th row. BTW that isn't a very good method for locating a particular
record, as you can't always be sure the order will be the same.
 
Back
Top