New topic: Updating a Recordset Field
<http://forums.realsoftware.com/viewtopic.php?t=30478> Page 1 of 1 [ 4 posts ] Previous topic | Next topic Author Message Miguel Dina Post subject: Updating a Recordset FieldPosted: Wed Oct 14, 2009 10:22 am Joined: Wed Mar 26, 2008 7:09 pm Posts: 81 Hi there, I need to change the value of a field in a recordset using a loop but updates are not been made. Here is the code: Quote: if r <> nil and r.RecordCount <> 0 then r.Edit do until r.EOF r.Field("EstadoID").IntegerValue = 7 r.MoveNext Loop r.Update end if Is this correct?. Kind regards, Miguel Top dglass Post subject: Re: Updating a Recordset FieldPosted: Wed Oct 14, 2009 10:44 am Joined: Fri Sep 30, 2005 9:29 am Posts: 608 Location: California At some point you need to .Commit the updates. Top timhare Post subject: Re: Updating a Recordset FieldPosted: Wed Oct 14, 2009 11:21 am Joined: Fri Jan 06, 2006 3:21 pm Posts: 6557 Location: Portland, OR USA r.Edit applies to the current record, so it should be called inside the loop. You update records one at a time, not an entire recordset. Code:do until r.EOF r.Edit r.Field("EstadoID").IntegerValue = 7 r.Update r.MoveNext Loop db.Commit Top Miguel Dina Post subject: Re: Updating a Recordset FieldPosted: Wed Oct 14, 2009 11:52 am Joined: Wed Mar 26, 2008 7:09 pm Posts: 81 Thanks very much. It is now working beautifully! Miguel Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 4 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
