Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sharing form
Message
 
À
29/10/2004 04:58:52
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 5
Divers
Thread ID:
00954064
Message ID:
00955708
Vues:
17
After You paste this function in Your method of the form remove following row:
Function GetNextBillNo && That is not allowed in method of the forms
You can't invoke the function using GetNextBillNo() but thisform.GetNextBillNo()

Also I think there is a problem in that function. You try to lock the record You just appended, You ALWAYS can do that, So The function must look like that:
Function GetNextBillNo
local lcAlias, lnReprocess, lnBillNo
lcAlias=select() && remeber alias  can i replace my (temp.table) with &&&lcAlias=select(temp)
lnReprocess=SET('REPROCESS()') && remember value
SET REPROCESS TO 1 && Retry evey one second
SELECT 0 && find an available work area
USE mstr order BillNo again && BillNo is an index tag on BillNo
DO WHILE .T.
   GO BOTTOM && this record holds the highest number
**************************************************************************************
*** Here it is the change You try to Lock the Last record not that You just appended *
**************************************************************************************
   IF !RLOCK() && Someone else is doing exactly the same, so he comes first     
      WAIT 'Someone else is billing, you must wait!' WINDOW NOWAIT
      LOOP && wait a second and try again
   ENDIF
***************************************************************************************
   lnBillNo=mstr.BillNo
   APPEND BLANK
   REPLACE Billno with lnBillno + 1
   lnBillNo=mstr.BillNo && lnBillNo is the next bill number
   EXIT
ENDDO
USE && Close
WAIT CLEAR && In case any Wait window is open
SET REPROCESS TO lnReprocess && always restore
SELECT (lcAlias) && always restore
RETURN lnBillNo
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform