Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Field value in Multiuser environment
Message
De
06/06/2001 03:02:17
Walter Meester
HoogkarspelPays-Bas
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00515570
Message ID:
00515591
Vues:
13
Hanafi,

You can use a table to store the last invoicenumber and lock the table or specific record to refresh its content. For example:
FUNCION NewKey (cIdentity)
LOCAL nSel, nValue

nSel=SELECT(0)
SELECT 0
USE Keys
LOCATE FOR Identity=cIdentity
IF !FOUND()
   INSERT INTO Keys (Identity, Value) VALUES (cIdentity, 1)
   nValue=1
ELSE
   =RLOCK()
   REPLACE Value WITH Value + 1
   nValue=Value
   UNLOCK 
ENDIF
USE
SELECT (nSel)
RETURN nValue
I Hope this helps,

Walter,



>I am using Sales.SalesNum field as an invoice number, which will increment automatically each time the user append
>a new invoice.
>I place the master SalesNum in Data.SalesNum, so when the user click the new button the textbox "TxtSalesNum"
>will have the value Data.SalesNum + 01.
>
>The problem accured in multiuser environment.
>
>User 1 : giving SalesNum = 1
>
>User 2 : giving Salesnum = 1
>
>User 1 save the invoice and having salesnum = 1 and click the new button. TxtSalesnum.value = 2
>
>User 2 Save the invoice and having salesnum = 2. But when he click the new button, he have TxtSalesnum.value = 2
>not 3.
>
>Thank's
>
>In Save Procedure
>
>Sele Data
>Repl SalesNum with SalesNum + 01
>TableUpdate(.T.)
>Unlock All
>
>
>
>in PNew Procedurte ( When The user click the New Button)
>
>Thisform.TxtSalesNum.Value = Data.SalesNum + 01
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform