Dawa,
Is there anywhere in your application that the table Stafile is open exclusive? May be one user attempt to insert a record therefore other is open that table exlusive, doing some REINDEX or PACK...
By the way according to help the right sintax of RLOCK is:
RLOCK([nWorkArea | cTableAlias] | [cRecordNumberList, nWorkArea
| cTableAlias])
so you must change
if rlock("0",'stafile')
to
if rlock('stafile')
In addition, You can put a messagebox before ROLLBACK to annonce to user that no changes is commited.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.