>From: "John Bracken" <jb410002@e...>
>Date: Wed, 27 Feb 2002 11:20:50
>
>I have a VB project, which which manages an Access 97 database.
>One of the fields is auto-incremented with each new record.
>I'm trying to write an SQL query which will identify the ID of the latest
>record, then add 1 to produce the value for the next record.
If there is any chance of upgrading the db to Access 2000, you can use the
SQL statement "SELECT @@IDENTITY" to get the primary key of the most
recently added record. Trying to anticipate what the next ID *might* be is
very risky: particularly if you are using Autonumber/random fields as you
PK, a practice which, incidently, will double the maximum number of records
you can add to a table.
Regards,
-Toby