[AccessD] Custom autonumbering

David McAfee davidmcafee at gmail.com
Wed Jul 1 18:27:45 CDT 2009


Asger, just make sure to use an autonumber as your PKID, not your generated
number.

If at some later point in life, the criteria changes for the number, so be
it.
You PKs & FKs will love you for it.

You can create a table for the sequence number by inserting a value into a
record with only an Autonumber PK and some other field.

I had a request where the facility request numbers were the date and a
sequence of 3 digits ( 20090701001-20090701999)

I created a sequence table and have a job that truncated that table each
night at midnight.

You need to know what happens if a number is in process of being created and
a second user
creates a new number but the first user/process cancels.

Will you leave a hole?

Will you save the record and flag it as cancelled?

What if user 2 fnishes before user 1, does it matter if they are out of
sequence, yet the numbers are sequential?

David



-----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Asger Blond
> Sent: 01 July 2009 23:58
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] Custom autonumbering
>
> Actually I don't want to mimic the AutoNumber field type. I want a custom
> autonumber which is 1) reliable sequential, and 2) customable. Your
> two-table solution provides the first requirement and I will consider it
> for
> future use. But sometimes I need to supply an easy way of creating a new
> offset for the autonumber: e.g. using the current year as a leading number
> the user should have the ability to change the number let's say 20098001 to
> 20100001, making this a new starting point for the sequential numbering
> (normally this custom autonumber field should be locked on the form and
> only
> editable providing a password).
> I still find the DMAX-solution easier to manage for the second requirement.
> But as said I appreciate your proposal for a reliable sequential numbering.
>
> Asger
>
>



More information about the AccessD mailing list