472,981 Members | 1,478 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,981 software developers and data experts.

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 2094
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: PT | last post by:
I got a problem. And thats..... First of all, I got these three tables. ------------------- ------------------ ---------------------- tblPerson tblPersonSoftware ...
2
by: Johan den Boer | last post by:
Hi, How to find out the last insert primary key value when a field is auto incremented. Select the maximum value from the table is not an option because users can add rows very quickly. First...
5
by: Ian | last post by:
(Please excuse the rookie question) Why don't I get the value of "windows" in my file? My xml file is located in http://www.otima.ca/XML/auto.xml and the xslt file is...
2
by: Eugene | last post by:
Hi, Problem: I need to get the value of auto-incremented field from just inserted record In Oracle this is INSERT .. RETURNING command. In SQL Server there are @@IDENTITY, IDENT_CURRENT,...
0
by: amywolfie | last post by:
Hi all: I have a subform called sfrmFootnotes linked to main Form frmFeeInput (the latter based on tblFees). tlkpFootnotes contains the PK for Footnotes. tjnCode_Footnotes is a join table...
1
by: dusty | last post by:
Hi, I'll try to simplify the problem: I created a table "TestTable" in a database on the SQL server. The first column, 'id', is the primary key with a auto-increment identity. I want to work...
4
by: Mr. Wilson | last post by:
On this page (just a demo) I can’t get IE6 to auto-select the first item in the dynamically-generated drop-down menus. Well, that isn’t entirely true. Sometimes it works properly, but never on the...
41
by: Jim | last post by:
Hi guys, I have an object which represents an "item" in a CMS "component" where an "item" in the most basic form just a field, and a "component" is effectively a table. "item" objects can be...
0
by: hellboss | last post by:
Hi im using asp.net vs05 with sql05 , I Started on creating a Stored Procedure where i wrote some insert statement and i just got the Auto Generated column value by using Scope identity or...
1
by: bytesFTW99 | last post by:
I have auto-suggest that brings down first and last name into a input box, it also brings into another input box the id of the selected item. on that id i want to be able to auto fill a form from...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.