Autonumber -- How to access next one?

  • Thread starter Thread starter Nikos Antoniou
  • Start date Start date
N

Nikos Antoniou

Hello ng,

I would like to ask if there is a way to access the next Autonumber assigned
by MSAccess on a record. This is can be done in SQL Server with the variable
@@identity, I hope there is a way to "know" the next Autonumber value at the
time of a new record addition. Right now, I do it by starting a Transaction
via ADO and after the addition, I get the max Key from that table.
Excuse me if this question has already been answered.

Thanks in advance,

Nikos Antoniou

PS. I talking about incremental Autonumber.
 
It is not possible to return the Autonumber value assigned from an Append
query.

With code, you can create the new record and return the new value.

Function AddRecord()

..AddNew
lngNewID = !ID
..Update

AddRecord = lngNewID

End Function

--
HTH,

Steve Clark, Access MVP
FMS, Inc.
Professional Solutions Group
http://www.FMSInc.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Is your Access database too slow?
Are you ready to upgrade to SQL Server?
Contact us for optimization and/or upsizing!
http://www.FMSInc.com/consulting
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
Back
Top