>I can not get the following code to lock a record. What can can cause this failure? I've got multilocks on, and reprocess set to automatic for testing.
>
>STORE recno() to gcreclist2
>DO WHILE NOT RLOCK('myfile')
> RLOCK(str(gcreclist2), 'myfile') &&& Lock clinical record
> IF NOT RLOCK()
> Wait window "Somebody else is working on this record"
> ELSE
> UNLOCK
> ENDIF
>ENDDO
>
>thanks
It looks like your default work area is "MyFile", and the record pointer is already on the record you want to lock. You don't need to go through that many gyrations:
LOCAL llLocked
llLocked = .F.
DO WHILE NOT llLocked
IF RLOCK("MyFile")
llLocked = .T.
ELSE
WAIT WINDOW "Couldn't Lock Record !"
ENDIF
ENDDO
UNLOCK IN MyFile
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up