473,385 Members | 1,218 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,385 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 2811

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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.