424,054 Members | 1,078 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,054 IT Pros & Developers. It's quick & easy.

Autonumber

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


P: n/a

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 discussion thread is closed

Replies have been disabled for this discussion.