Does...
LOCATE FOR NOT ISRLOCKED() WHILE NOT EOF()
... work for you? By including the WHILE, the LOCATE begins its search at the current record instead of at the first record.
>I’m trying to locate the next available unlocked record in a table.
>The table has about 150 records in it.
>
>When I use following code it may take 30 seconds if the 31 record is next available unlocked record and rLock() will return .T. but it is slow
>
>Sele the table
>scan
> IF rlock() = .t.
> ?rlock()
> endif
>endscan
>
>
>if I use this code it flies thru the isRlock function but will get .f. when it tries rLock()
>
>Sele the table
>scan
> IF isRlock() = .t.
> ?rlock()
> endif
>endscan
>
>What is the fasted way to do this?
Mark McCasland
Midlothian, TX USA