Information générale
Catégorie:
Codage, syntaxe et commandes
Titre:
Uniq ID number for fields in table in single and network
Hi to all,
I have one free table which has one field with value which should automatic rise up from 1 to endless (999999) like uniq identifier of each records (like Autonumber in Access) and in order to solve this I put this code in Valid Events of cmdAdd commandbutton (from buttonset1 group):
LOCAL br
if this.parent.addmode=.f. then
wait wind 'Saved...' at 20,10 nowait
DIMENSION maks(1)
IF RECCOUNT()=1 then && was just 1
br=1
ELSE
SELE MAX(n_rok) FROM nrok INTO ARRAY maks
br=maks+1
ENDIF
repla nrok.n_rok with br
=tableupdate(.t.)
endif
if this.parent.addmode=.t. then
wait wind 'In mod for input' at 20,10 nowait
endif
thisform.refresh
*------
I have fear that in multiuser environment could happen that both user get same value for their new records or that could be duplicate possible.
Is there any better and for sure solution?
Thanks in advance
Elvir
Suivant
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