470,815 Members | 1,252 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

Getting value of last auto-number

I am trying to use jet/access to store my data but I need some
feedback from the database.

I have a table that has an auto-number as a primary-key, so when I
insert a post into the table the ID is automatically generated, but my
problem is that I need to get this value, in MS-SQL I could do a
@@identity so get it, but is there a way in jet/access?

If not then I could always use another table as id-reference, and keep
store values in there like 'insert into tblref (Name, Value) values
('tblCustomers', 1)', then do a select and update with value+1, but
then I would need to lock the table/row so no other processes could
read the value while im updating it. Anyone got a solution or do I
have to look for another database?

Thanks in advance

-Thomas Leggett
tl@rem@ov*@digitalteknikk.no
Nov 12 '05 #1
1 1999
DMax("[NameOfPrimaryKeyField]","NameOfTable")

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com


"Thomas Leggett" <tl@digitalteknikk.no> wrote in message
news:8d**************************@posting.google.c om...
I am trying to use jet/access to store my data but I need some
feedback from the database.

I have a table that has an auto-number as a primary-key, so when I
insert a post into the table the ID is automatically generated, but my
problem is that I need to get this value, in MS-SQL I could do a
@@identity so get it, but is there a way in jet/access?

If not then I could always use another table as id-reference, and keep
store values in there like 'insert into tblref (Name, Value) values
('tblCustomers', 1)', then do a select and update with value+1, but
then I would need to lock the table/row so no other processes could
read the value while im updating it. Anyone got a solution or do I
have to look for another database?

Thanks in advance

-Thomas Leggett
tl@rem@ov*@digitalteknikk.no

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Ian | last post: by
2 posts views Thread by Eugene | last post: by
41 posts views Thread by Jim | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.