"vanderghast" <vanderghast@com> wrote in
news:2F2C4F42-3FED-41D7-BECA-(E-Mail Removed):
> With ADO, you can read the key after the ***UPDATE**** since the
> record
> with the
> focus will be the one you just added.
>
> and not after the ***AddNew***
And, of course, there's always:
SELECT @@IDENTITY
that could be used after the insert is done. This is paricularly
useful in cases where you choose to use a SQL INSERT instead of a
recordset to add data -- execute the INSERT and then immediately ask
for the identity value, and you'll be done. In fact, you can do
this:
lngNewID = db.OpenRecordset("SELECT @@IDENTITY")(0)
Of course, you have to be certain you use the same database variable
that you used for Executing the INSERT. That is, you can't use
CurrentDB for the execute followed by the statement above with
CurrentDB in place of the db variable.
--
David W. Fenton
http://www.dfenton.com/
usenet at dfenton dot com
http://www.dfenton.com/DFA/