why ".Bookmark = .LastModified"?

P

Paul W

Hi - I'm taking over an Access 2000 app.

In any loop where the code adds/edits data to a recordset, it has this:

while...
.AddNew
...
.Update
.Bookmark=.LastModified
end

I understand what the last line would do, I just don't understand what good
it might do in this situation. Any thoughts?

Thanks,

Paul.
 
K

Ken Snell [MVP]

1) The programmer will want to do more editing of this record later in the
code, so this code step avoids the need to go looking for the record again.

2) The programmer wants to use the autonumber field value later in the code.

3) The programmer just copied the code from somewhere else and didn't know
why the code step was there, either, so he/she left it in "just in case it
does something really, really, really important".
 
A

Allen Browne

Paul, you should be aware that the newly added record is *not* automatically
the current record, i.e. unless you set the bookmark to the LastModified,
you should not go on to do other things with this record or its values.

That's essentially what was behind Ken's #1 and #2.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top