473,395 Members | 1,974 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,395 software developers and data experts.

Autonumber

Hello,

I have a question if I could ask of you. I am trying to generate a
sequence of numbers:
The first number is an original, the second are amendments to the
original whenever needed. How do I generate and keep this sequence
automatically when I need a new number. For example, these three
numbers are used, and instead of going manually and picking which
number comes next for the particular case, when I open my form to add
new record and insert the case how do you make access automatically
fill in the next sequential number, only in add new record. I know its
a loop structure but how?

Case Number
AAA ***-***-123 1 number used
***-***-123A 2 number used
***-***-123B 3 number used
Need next
number automatically filled in the form,
to input new amendment to Case AAA
1st 3 numbers must stay the same
2nd 3 number must stay the same
3rd set of numbers can change.
* represents number or alpha character

Jan 22 '07 #1
1 2812

chris wrote:
Hello,

I have a question if I could ask of you. I am trying to generate a
sequence of numbers:
The first number is an original, the second are amendments to the
original whenever needed. How do I generate and keep this sequence
automatically when I need a new number. For example, these three
numbers are used, and instead of going manually and picking which
number comes next for the particular case, when I open my form to add
new record and insert the case how do you make access automatically
fill in the next sequential number, only in add new record. I know its
a loop structure but how?

Case Number
AAA ***-***-123 1 number used
***-***-123A 2 number used
***-***-123B 3 number used
Need next
number automatically filled in the form,
to input new amendment to Case AAA
1st 3 numbers must stay the same
2nd 3 number must stay the same
3rd set of numbers can change.
* represents number or alpha character
>when I open my form to add new record and insert the case how do you make
access automatically fill in the next sequential number
The answer depends on whether your application is going to be
multi-user. If it is, then you'll have to abide by the rules of
generating sequential numbers in a multi-user environment. Your choices
are:

- The numbers will be unique.

- The numbers will be sequential with no gaps.

- The numbers will be assigned before the record is saved.

In a multi-user environment you must choose which TWO of the above
conditions you want.

OTOH, if your application is single-user then you can just use
something like DMax() to determine the highest value in the table, as
in

strMaxId = DMax("Case_ID", "tblCases", "Case_ID LIKE 'FOO-BAR-*'")

and then increment the last number, or append the next letter of the
alphabet, or whatever.

Jan 22 '07 #2

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

Similar topics

3
by: Ilan Sebba | last post by:
I have a 'supertype' table with only one field: autonumber. Call this table the 'parent' table. There are two subtypes, 'androids' and 'martians'. Martian have only one thing in common: they give...
33
by: Lee C. | last post by:
I'm finding this to be extremely difficult to set up. I understand that Access won't manage the primary key and the cascade updates for a table. Fine. I tried changing the PK type to number and...
35
by: Traci | last post by:
If I have a table with an autonumber primary key and 100 records and I delete the last 50 records, the next record added would have a primary key of 101. Is there any way to have the primary key...
4
by: yf | last post by:
A KB article "http://support.microsoft.com/default.aspx?scid=kb;en-us;209599" tells that the maximum number of records that a table may hold if the PRIMARY key data type is set to AUTONUMBER is...
26
by: jimfortune | last post by:
Sometimes I use Autonumber fields for ID fields. Furthermore, sometimes I use those same fields in orderdetail type tables. So it's important in that case that once an autonumber key value is...
8
by: petebeatty | last post by:
I have created a SQL string the properly inserts a record in the table. However, the insert does not occur at the end of the table. Instead it inserts a record after the last record that I viewed....
11
by: Alan Mailer | last post by:
A project I'm working on is going to use VB6 as a front end. The back end is going to be pre-existing MS Access 2002 database tables which already have records in them *but do not have any...
1
by: gtwannabe | last post by:
I'm having a problem with a form that uses AutoNumber as the primary key. I have an Abort button to delete the current record and close the form. If AutoNumber is assigned, the code executes a...
9
by: Tom_F | last post by:
To comp.databases.ms-access -- I just discovered, to my more than mild dismay, that some tables in my Microsoft Access 2003 database have duplicate numbers in the "AutoNumber" field. (Field...
6
by: ashes | last post by:
Hi, I am creating an ecommerce website using Microsoft Visual Studio, VB.Net and MS Access 2003. I am new to VB.Net When someone wants to register on the website, they fill out a form and the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.