SELECT IDENT_CURRENT('MyTable') function in access?

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
 
M

[MVP] S.Clark

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

Duane Hookom

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
 
T

Tor Inge Rislaa

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top