SELECT IDENT_CURRENT('MyTable') function in access?

  • Thread starter Thread starter Tor Inge Rislaa
  • Start date Start date
T

Tor Inge Rislaa

SELECT IDENT_CURRENT('MyTable') returns the last identity value generated
for a specified table in an MS SQL Server.
Is there a similar function in access?

TIRislaa
 
No.

Dmax([IDField], "tblName") can get you there, but use with caution in a
multi-user environment.

--
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
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
I think you are missing some quotes:
Dmax("[IDField]", "tblName")
If a query is preferred then
Select Max(IDField) As MaxID FROM tblName;

--
Duane Hookom
MS Access MVP


[MVP] S.Clark said:
No.

Dmax([IDField], "tblName") can get you there, but use with caution in a
multi-user environment.

--
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
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Tor Inge Rislaa said:
SELECT IDENT_CURRENT('MyTable') returns the last identity value generated
for a specified table in an MS SQL Server.
Is there a similar function in access?

TIRislaa
 
These solutions are fine if there are some data in the table. If you add 10
records to the table and then delete them the, next number should be current
id + 1 (11), but as long as there are no data the query returns nothing.
Still Access keep track of what is the last ID generated, and that's the
number I am looking for.



TIRislaa



Duane Hookom said:
I think you are missing some quotes:
Dmax("[IDField]", "tblName")
If a query is preferred then
Select Max(IDField) As MaxID FROM tblName;

--
Duane Hookom
MS Access MVP


[MVP] S.Clark said:
No.

Dmax([IDField], "tblName") can get you there, but use with caution in a
multi-user environment.

--
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
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Tor Inge Rislaa said:
SELECT IDENT_CURRENT('MyTable') returns the last identity value generated
for a specified table in an MS SQL Server.
Is there a similar function in access?

TIRislaa
 
Back
Top