Click to See Complete Forum and Search --> : .EOF and adding records
Mildumar
Aug 16th, 1999, 12:15 AM
Kent, it seems to me in Access that you have to enter some data in the new record before it is considered a record. If it is blank it doesn't give you a new record or EOF as the new record. Hope this helps.
MillerD
KentJ
Aug 16th, 1999, 12:24 AM
Mildumar, thanks for the reply!
In fact I do. After the new record is created, I write data to the fields, perform an update (which I verify appears in the db from access) and then do a movenext. I expect at this point to be once again after the last record, but the new record remains the current one! A second .movenext gets me to the end.
KentJ
Aug 16th, 1999, 11:55 AM
I have been pulling my hair out over a seemingly simple thing: i am overwriting records in an existing database. each time I do a .movenext I check the .EOF flag to see if I've run out of existing records. If so then I add a record to the recordset, the .eof flag clears, and I write the data and do an update. So far so good - if I do a .movenext after adding, I should get another .eof = TRUE, right? Wrong! The new record stubbornly remains the current record, and .eof=False. It takes a 2nd .movenext for the .eof to set. Can anyone explain this behavior?
(btw, it's vb6 pro, Acccess97 via Jet 3.51)
thanks!
jim
Aug 17th, 1999, 11:32 AM
This is because of the Access behavior is to go back to the record that was current before the AddNew command.
If you use the LastModified property you can get to the new record --- but the most surefire way to ensure that you are on the last record in the dataset is to use the Movelast command.
KentJ
Aug 18th, 1999, 07:36 PM
Thanks, Jim! It seems kind of weird, but it seems correctly predict the behavior. BTW, is this an Access thing, or a Jet thing???
JHausmann
Aug 18th, 1999, 10:51 PM
Jet
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.