>>>In any case, only assign the number when the record is saved.
>>>
>>>If you need code for getting a sequence from a sequence table, I can search for mine.
>>
>>Hilmar,
>>
>>I've changed my mind - I better add default values and counters table, so I would appreciate the code.
>>
>>Thanks.
>
>It is very old code, actually (may look unelegant):
>
>PROCEDURE gettablecounter
>PARAMETER cTablename
>LOCAL nCounter
>IF seek(cTablename,'counters','tablename')=.f.
> RETURN 0
>ENDIF
>IF rlock('counters')=.f.
> RETURN 0
>ENDIF
>nCounter=counters.counter+1
>REPLACE counter with nCounter in counters
>UNLOCK in counters
>RETURN nCounter
>ENDPROC
>
Thanks, Ed. I've already done with this using Cetin's old code.
If it's not broken, fix it until it is.
My Blog