I use a simple method. It assumes each user has a unique ID. I insert a
record into the table with its autonumber column. I set only the unique ID
in one of the tables text columns where there is no chance that the ID could
be a true value in that field. I then select the autonumber value where the
text column = the unique ID. I then load the actual data with an update
statement.

One other thing, sometimes the user will abort before the update takes
place. Therefore I try the select step first, before inserting a row. If it
succeeds I know the user had aborted and I use the value I received. This
eliminates unused numbers or holes in the sequence.

This technique may be less efficient, but I believe it is foolproof.

An additional advantage is that after the insert and select, the autonumber
value is available for display to the user - perhaps to write on the source
document etc.

Bill Cook
Kent WA

----- Original Message -----
From: "Lynn Shelton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 10, 2001 8:36 PM
Subject: Manually doing autonumbered field


> Due to some programming constraints, I have to do my own autonumbering
field
> management - i.e. not using the standard autonumbered column method.  I
can
> do this with no problem on a stand-alone application, but I am concerned
> with potential problems if the application is adapted to operate on a
> network in multi-user mode.
>
> I remember a couple of years ago a pretty good discussion on methods for
> doing one's own autonumber routine that avoids duplicate numbers being
> assigned in a multi-user situation.  I had this discussion printed out at
> one time, but have lost it.  Can some of you give me some refresher
> hints/tips?  I have to have this application ready for demonstration in
the
> next couple of days, so I will do my stand-alone (single-user) method for
> now, and hopefully modify the code later for conflict-avoidance in
> multi-user mode.
>
> TIA
> Lynn Shelton
> [EMAIL PROTECTED]
>
>

Reply via email to