Hi,
I have this simple code in a push-button:
** CREATE NEXT AVAILABLE UID **
IF USED("NEXTLOCALNUM")
SELECT NEXTLOCALNUM
ELSE
USE NEXTLOCALNUM IN 0
ENDIF
XX=''
XX=NEXTLOCALNUM.NEXTLOCALN+1
SET MULTILOCKS ON
=CURSORSETPROP('Buffering', 5, 'NEXTLOCALNUM')
REPLACE NEXTLOCALNUM.NEXTLOCALN WITH XX
=TABLEUPDATE(.T.)
L_ORDNUM="L"+ALLTRIM(STR(XX))
THISFORM.TEXT1.VALUE=L_ORDNUM
THISFORM.REFRESH
** CREATE NEXT AVAILABLE UID END**
It's a multi-user environment & basically, it provides an ongoing unique sequential ORDER NUMBER (for each order created). Simple enough, YET, the problem I'm seeing is that if 1 user pushes that button and then another user pushes that button, the 1st and 2nd user sometimes (not all the time) get the same order number (which is weird because I'm TABLEUPDATEing, so the value should be different, correct?
I hope you understand what I'm saying.
Please help in fixing this bug because I don't know why it's happening.
Thanks,
FOXUP!
I have this simple code in a push-button:
** CREATE NEXT AVAILABLE UID **
IF USED("NEXTLOCALNUM")
SELECT NEXTLOCALNUM
ELSE
USE NEXTLOCALNUM IN 0
ENDIF
XX=''
XX=NEXTLOCALNUM.NEXTLOCALN+1
SET MULTILOCKS ON
=CURSORSETPROP('Buffering', 5, 'NEXTLOCALNUM')
REPLACE NEXTLOCALNUM.NEXTLOCALN WITH XX
=TABLEUPDATE(.T.)
L_ORDNUM="L"+ALLTRIM(STR(XX))
THISFORM.TEXT1.VALUE=L_ORDNUM
THISFORM.REFRESH
** CREATE NEXT AVAILABLE UID END**
It's a multi-user environment & basically, it provides an ongoing unique sequential ORDER NUMBER (for each order created). Simple enough, YET, the problem I'm seeing is that if 1 user pushes that button and then another user pushes that button, the 1st and 2nd user sometimes (not all the time) get the same order number (which is weird because I'm TABLEUPDATEing, so the value should be different, correct?
I hope you understand what I'm saying.
Please help in fixing this bug because I don't know why it's happening.
Thanks,
FOXUP!