Home All Groups Group Topic Archive Search About

MS Access equivalent to IDENT_CURRENT

Author
13 Oct 2005 8:03 PM
Bob
I am using an ODBC Access database along with Visual Basic.  I have created a
Header/Detail screen....   My question is: After creating the Header Record,
I need to retrieve the Record ID (rec_id is auto-number) from this Header. 
With SQL I just use IDENT_CURRENT.  Is there an Access equivalent to
IDENT_CURRENT?

Author
13 Oct 2005 8:44 PM
Jeff Johnson [MVP: VB]
"Bob" <B**@discussions.microsoft.com> wrote in message
news:D61DBC6E-CF32-45CA-9712-D1D7BDA7C3CF@microsoft.com...

>I am using an ODBC Access database along with Visual Basic.  I have created
>a
> Header/Detail screen....   My question is: After creating the Header
> Record,
> I need to retrieve the Record ID (rec_id is auto-number) from this Header.
> With SQL I just use IDENT_CURRENT.  Is there an Access equivalent to
> IDENT_CURRENT?

Use can use the LastUpdated (wait, I think it's LastModified) property of
the DAO Recordset to set the Bookmark of the recordset to the row you just
added, and then you can retrieve your new AutoNumber value.
Author
17 Oct 2005 2:05 PM
Paul Clement
On Thu, 13 Oct 2005 13:03:02 -0700, Bob <B**@discussions.microsoft.com> wrote:

¤ I am using an ODBC Access database along with Visual Basic.  I have created a
¤ Header/Detail screen....   My question is: After creating the Header Record,
¤ I need to retrieve the Record ID (rec_id is auto-number) from this Header. 
¤ With SQL I just use IDENT_CURRENT.  Is there an Access equivalent to
¤ IDENT_CURRENT?

If I remember correctly, the autonumber value is available after calling the Recordset AddNew
method. For ADO you need to use a server-side cursor (which is the default).


Paul
~~~~
Microsoft MVP (Visual Basic)