473,403 Members | 2,323 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

incrementing recordID without using AutoCount

Where can I find some info on grabbing the recordID of the last record,
incrementing it by one, and using the new number in a new record.
Nov 12 '05 #1
2 2541
The highest existing record is:
DMax("recordID", "MyTable")

In the BeforeUpdate event of your form:
Me.recordID = Nz(DMax("recordID", "MyTable"), 0) + 1

Note that this could result in duplicates (not saved) if multiple users are
doing this at once. Using Form_BeforeUpdate delays this to the last possible
moment, and reduces (but does not eliminate) this risk.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html

"Payson Books" <pr*******@lightspeed.net> wrote in message
news:AF**************@newsread4.news.pas.earthlink .net...
Where can I find some info on grabbing the recordID of the last record,
incrementing it by one, and using the new number in a new record.

Nov 12 '05 #2
See article # 114 "Creating an Incrementing ID with Date Information" at
http://www.helenfeddema.com/access.htm
This was just published in a recent issue of "Woody's Access Watch" on 8/28/03.

Tom
________________________________________________

"Payson Books" <pr*******@lightspeed.net> wrote in message
news:AF**************@newsread4.news.pas.earthlink .net...
Where can I find some info on grabbing the recordID of the last record,
incrementing it by one, and using the new number in a new record.

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mothra | last post by:
Here's what I'm trying to do (kill off old Unix logins): --------------------- $i=0; while (<$who>) { chomp($_); my @line = split(/\s+/, $_); # Split it into an array next unless ($line...
3
by: DaveHayzen | last post by:
The following SQL query :- SELECT CardHolder.RecordID, History.GenTime, History.Link1 FROM History FULL OUTER JOIN Card ON History.Param3 = LTRIM(RTRIM(Card.CardNumber)) FULL OUTER...
2
by: brian | last post by:
Hi, before coming to .NET, I utilized regular expressions mostly in JScript / JavaScript and also in my favorite text editor: TextPad (www.textpad.com) I don't know about JScript/JavaScript, but...
10
by: Antanas | last post by:
The problem is that when AddID is used multiple times in the same select statement, it returns the same value in all places. How could I force function AddID to increment OBJECTID sequence? Here...
13
by: John Leslie | last post by:
Hi, If I have: struct foof { long x; }; void blarg(void) {
53
by: subramanian100in | last post by:
I saw this question from www.brainbench.com void *ptr; myStruct myArray; ptr = myArray; Which of the following is the correct way to increment the variable "ptr"? Choice 1 ptr = ptr +...
1
by: asandiego | last post by:
Hey guys, this is my first post here but have been checking this site a lot for anything I need. I hope someone can lead me to what I should do or just an idea to what can be done. What I'm...
6
by: John | last post by:
I have written a VB.NET DLL that is called by a third party program. If I make any changes in the DLL and then try to replace my DLL file the third party program will abort, saying that the DLL...
9
by: subramanian100in | last post by:
The following portion is from c-faq.com - comp.lang.c FAQ list · Question 6.13 int a1 = {0, 1, 2}; int a2 = {{3, 4, 5}, {6, 7, 8}}; int *ip; /* pointer to int */ int (*ap); /* pointer to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.