Information générale
Catégorie:
Codage, syntaxe et commandes
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
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement