Les, Autonumber is a "behind-the-scenes" counter and is separate from
the data stored in the rows a table.
The NEXT function increments the autonumber counter but does not update
data in any rows in a table.
After a NEXT command, I use an UPDATE command to update the _data_ in
the row - that displays the last autonumber value that was NEXTed.
(that was an awkward piece of English, sorry):
SET VAR vAutoNum = (NEXT(Control,TestAutoNum))
UPDATE Control SET TestAutoNum = .vAutoNum
Also see my post from 6/25.
Doug
On 6/26/2013 2:28 PM, Les Stark wrote:
Thanks for the feedback. The (NEXT(,...,...)) function seems to be my
answer.
I think my duplicate invoice numbers were happening when a slow
network connection was failing to update the single column in a single
row where my invoice number is stored. Before it could update someone
on another connection was retrieving the same number for their invoice.
I needed a system that did not depend of an UPDATE command to set the
next number.
If I use the NEXT command, no matter who hits the invoice number it
will always assign the next number.
What I don't understand is.... The invoice number column that is set
to autonumber and that is being polled for the NEXT invoice number is
not updated and always shows the starting number! It seems to not
matter if you disconnect, drop rbase, upon restart it will assign the
correct next number even though the field shows the original starting
number. It must be storing the next autonumber in the database...
not in memory.
I can use this but it feels strange, not seeing, what the next number
is. I can update another column to store the current next number, but
to update the autonumber column would create the same duplicate
invoice number problems when a station was slow to update.