General information
Category:
Coding, syntax & commands
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only