>I have a free table (VFP6/SP3) with 4 records in it. At app startup, I want system1 to get a record lock on record1, system2 to get a record lock on record2, etc. I opened a dummy VFP session, opened the table shared, and rlock(1) at the command window to rlock for that session. Then I ran the code below on a secord VFP session, and it locks records 2
and 3. Can someone help me with my logic here? I want to limit the table to 4 records for 4 VFP sessions. Help?
How about this:
local llLockOK
llLockOK = .F.
clear
set reprocess to 2 automatic
if !used('safety')
use safety in 0 shared
endif
select safety
Do While !llLockOK And !EOF('safety')
If RLock()
llLockOk = .T.
Else
Skip
EndIf
EndDo
If llLockOK
&& Ok, we found a lock and can proceed!
Else
&& No lock available!
EndIf
Sylvain Demers