Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
File Locking
Message
 
 
To
21/01/2001 23:46:47
Agnes Cheng
DynamicTech Consultants Ltd.
Hong Kong, Hong Kong
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00466456
Message ID:
00468886
Views:
16
You can do it f.ex like this:


Function Getinvnumber

LOCAL ;
lnOldSel, ;
lnOldReProcess, ;
llUsed, ;
lncRetVal


m.lnOldSel = SELECT()
m.lnOldReProcess = SET('REPROCESS')
m.lncRetVal = -1


SET REPROCESS TO 5 && or what best suits for you. Look help for set reprocess.

IF !USED('Invnumber')
USE Invnumber shared
Else
SELECT Invnumber
m.llUsed = .T.
Endif

IF FLOCK()
GO BOTTOM
m.lncRetVal = InvNumber.Invnumber + 1
INSERT INTO INVNUMBER (INVNUMBER) VALUES (m.lncRetVal)
*!* You may save changes if Invnumber.dbf is buffered with
*!* TABLEUPDATE(.T.,.T.)
UNLOCK
ELSE
*!* Maybe some messages here
*!* messagebox(Can't ...',64,'')
ENDIF

*!* Cleanup
IF !m.llUsed
USE
Endif

SELECT (m.lnOldSel)
SET REPROCESS TO (m.lnOldReProcess)

*!* If -1 is returned this function couldn't get the invnumber.
RETURN m.lnRetVal
Previous
Reply
Map
View

Click here to load this message in the networking platform