Les
Get the max INVNBR and add 1 to it
R:>SELECT(MAX(INVNBR) +1) INTO vInvNumb INDIC IV1 FROM INVNUM
Add a text column (35) named InvNbrUser to your table INVNUM
At the R:> AUTONUM INVNBR IN INVNUM USI .vInvNumb, 1 NONUM
Now in your code where you are getting the invoice number
INSERT INTO INVNUM (InvNbrUser) VALUE (CVAL('NETUSER'))
SELECT invNbr INTO vInvoiceNumb INDIC iv1 FROM InvNum WHERE InvNbrUser
= (CVAL('NETUSER') AND COUNT = INSERT
I'm doing this from memory so make sure to test it on your copy of the
database.
Buddy
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Les Stark
Sent: Tuesday, June 25, 2013 1:33 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Assigning Invoice Numbers
I am having a problem with duplicate invoice numbers.
I have a table INVNUM with a column INVNBR that holds an integer value
for the invoice number.
When I create a new invoice, SET VAR VINV#=INVNBR IN INVNUM to get
the last invoice number from the table
then I increment that number SET VAR VINV#=(.VINVNBR +
1) the incremented number is used for the current invoice
then I update the table UPDATE INVNUM SET INVNBR=.VINV#
The table is ready for the next new invoice and the current invoice is
written with the value of VINV# This is a multiple user database and is
using Row Locks, Column Verify on the tables How am I getting duplicate
invoice numbers?
Is there a better way to assign Invoice Numbers?
--