I pulled your code directly into my application and I still can't get a record
to lock. When you use RLOCK how long do the locks stay in place? How can I be sure that all locks are released when I want them to be? Do different buffering schemes influence the ability to lock a record?
thanks
>>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
Some days it's not worth chewing through the leather straps ...