In addition to what Bob recommended, you could try a lock loop instead of a single attempt:
SET REPROCESS TO 0
lntimes=0
DO WHILE !LOCK() .and. lntime<100000
?LOCK()
ENDDO
SET REPROCESS TO 1
IF !RLOCK()
WAIT WINDOW "could not lock record"
ELSE
WAIT WINDOW "Successful record lock"
ENDIF
UNLOCK
SET REPROCESS TO 0
>Hi,
>I am using free table (buffering - 5) in my multiuser application. It is a simple customer data entry app.
>Also, I am using vfp wizard to generate the data entry form.
>
>I face problem of "RECORD IS USED BY ANOTHER USER" when the baseclass try to RLOCK(). It occured when 2 users try to add 2 different records at the same time. Once the 1st user add the record successfully, the 2nd user will get the error.
>However, if I try to debug it, browse the table and re-try the RLOCK() again then it will sucessfully. Any ideas?
>
>Why the "new" record could be locked while other user add another?
>
>Pls help!!
>
>Thank you
.·*´¨)
.·`TCH
(..·*
010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"