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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordset Amendments

Status
Not open for further replies.

ZOR

Technical User
Jan 30, 2002
2,963
GB
I did a posting at the weekend, RS.Move headaches, but got no replies, however am I on the correct road?. After amending records in a recordset in a loop, and using the RS.Update statement, should I use the RS.Movefirst statement before using the RS.Move(). I was having problems with subsequent records being the wrong ones and then thought logically if a record was changed, then the recordset would lose it's reference in moving to another record, unless it was led to the 1st record again. Does that make sense? Hope it's clear. Thanks
 
Forgot to say, putting RS.Movefirst before RS.Move seems to work, or is it a fluke. Thanks
 
After you run your update you should check rs.EOF to see if you have passed the last record, which seems likely. When you call Rs.MoveFirst you are telling the recordset to move to the first record so as long as there are at least two records it will always work. You should check both EOF and BOF before calling the move method.
 
Many thanks for the reply. How do I check for RS.EOF and RS.BOF ?. The first statement I have been using in RS terms is Set RS=DB.OpenRecordset("Name of Table", dbOpenTable),
then I was moving to the record with RS.Move RecN. Then I changed the data RS("Town")=Text3.Text. Then I did RS.Update and finally DB.Close. It was when I was doing a bulk record change that it went crazy until I added a RS.MoveFirst command before the next session of the loop.

Hope that makes sense, thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top