>Hi everybody,
>
>AFAIK there is no way in multi-user environment to have ID field incremented correctly without using extra table to keep the last ID (if we're not using autoincrement field). Using go bottom, grab the last number and start from there doesn't prevent two users from taking the same ID. Even if we put a check right after for the existance of ID.
>
>What do you think? Given only one table and no auto-increment is it possible to correctly auto-increment in multi-user environment?
>
>Thanks.
As Tore said, you must lock the table so no other can access it during the insert:
DO WHILE NOT FLOCK([MyTable])
WAIT WINDOW NOWAIT [I'm trying, I'm trying...]
DOWVENTS
ENDDO
SELECT MAX(ID)+1 FROM MyTable INTO ARRAY laId
INSERT INTO MyTable (Id, ....) VALUES (laId[1],...)
UNLOCK IN MyTable
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.