By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,283 Members | 1,572 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,283 IT Pros & Developers. It's quick & easy.

Getting value of last auto-number

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.