Re: ACCESS: Can I make Autonumber field start with 582 rather than
- From: "Jamie Collins" <jamiecollins@xxxxxxxxxx>
- Date: 19 Feb 2007 01:07:11 -0800
On Feb 17, 4:57 pm, "tina" <nos...@xxxxxxxxxxx> wrote:
did you database? it doesn't use an Autonumber field,
but rather a Long Integer field. the point of the code, and the example, is
to assign a sequential number programmatically so the user doesn't have to
do it manually.
Did you read what I wrote? Here's a précis: MAX + INCREMENT isn't a
reliable algorithm for generating Sequence numbers.
I did indeed look at the example application. Not at the code but I
did try out the application after I'd inserted a very high value into
the 'long integer' column it did indeed return 'error' rather than a
sequential number. Note the OP used the term 'autonumber' in the
subject of this thread so it is reasonable to point out that the
algorithm used in the suggested example application differs from that
of Access/Jet's autonumber functionality.
Did you try my code? If you did, you should have observed how
autonumber works i.e. when MAX + INCREMENT goes out of the value range
of 'long integer', rather than error it 'wraps'.
A better approach in SQL is to have a ready-rolled table of
incrementing integers, a standard trick in SQL (do a google search for
"Sequence table"). It is more reliable to have a permanent auxiliary
table rather than generate sequence numbers on the fly e.g. outer JOIN
the Sequence table and find the minimum unused value.
Jamie
--
.
- References:
- Prev by Date: Re: Looking for the right connection string
- Next by Date: Re: Query with two tables
- Previous by thread: Re: ACCESS: Can I make Autonumber field start with 582 rather than
- Next by thread: Re: ACCESS: Can I make Autonumber field start with 582 rather than 1.
- Index(es):
Relevant Pages
|