Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Scatter
Message
 
To
28/10/1997 06:03:43
Chiang Jeffrey
Paramoun Air Sea Svcs P/L
Singapore, Singapore
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00040596
Message ID:
00056953
Views:
43
Chiang,

Change your cod to this;

** This code is in the click event of the NEW button.
** the invsetup lookup table is also in the data environment of the form.

*******
LOCAL lcAlias
lcAlias = ALIAS()

SELECT InvSetup
meminv=0
meminvnext=0
&& Get next Invoice/do number

DO WHILE NOT RLOCK()
ENDDO
meminv=invsetup.nextinv
replace nextinv with nextInv + 1
UNLOCK
IF NOT EMPTY(lcAlias)
SELECT ( lcAlias )
ENDIF
RETURN meminv

******


Two things have been added, 1) the selected alias is proitected and 2) the invoice number table is locked before the next inv number is played with. The first insure that the calling environment is restored on teh way out of the routine and the second insures that there will never be duplication invoice numbers generated by this code.
Previous
Reply
Map
View

Click here to load this message in the networking platform