Is the error you get error #1884 - Uniqueness of Index MyIndex is Violated? This is what it looks like from your description. If so, there is a problem with how you are generating unique values for your primary key field.
>Hi all,
>
>In several applications wich are made based on same framework (clases build by myself) things are go wrong with indexes in saved records to tables one-to-many forms. If in application work one user everything is ok, but when working more users it's happening to save bad entryes in indexes (primary or candidate).
>When this happens there are NO crushes, power failures, net failures or other things.
>Supose we have 2 tables T1MASTER and T2CHILD with IDT as primary and link field and in T1MASTER candidate field NRDOC; when saving a new record there are possibilities to get T2CHILD recs saved, in T1MASTER get error NRDOC index violated; when open T1MASTER and activate index NRDOC and search for record just entered the pointer take me to a record with other NRDOC
>
>The save procedure in clases are like this:
>local ldatamaster,ldataslave,llink,lmasterlink,lerror
>
>ldatamaster=thisform.datamaster
>ldataslave=thisform.dataslave
>llink=thisform.datalink
>lmasterlink=thisform.datamaster+'.'+thisform.datalink
>
>thisform.activarecimp
>sele (ldatamaster)
>
>if thisform.writebuffer()
> begin transaction
> lerror=(txnlevel()=0)
> if !lerror
> if getfldstate(-1)=replicate("1",fcount()+1)
> =setfldstate(2,2)
> endif
> lerror=!tableupdate()
> if !lerror
> select (ldataslave)
> lerror=!tableupdate(.t.)
> endif
> if !lerror
> end transaction
> else
> thisform.lockscreen=.t.
> rollback
> thisform.refreshform()
> thisform.lockscreen=.f.
> =aerror(laerror)
> thisform.error(laerror[1],laerror[2],0)
> endif
> endif
>endif
>
>sele (ldatamaster)
>thisform.refreshform()
>return !lerror
Mark McCasland
Midlothian, TX USA