>How can I duplicate the following code using the seek command:
>
> SCAN
> SELECT Invoice
> LOCATE FOR in_code = lnCustCode
> DO WHILE FOUND()
> do some code
> CONTINUE
> ENDDO
> SELECT sometable
> ENDSCAN
>
>
>The is extremely slow as this codes is already in another loop and therefore a locate for the whole table is execute each time.
>
>Thanks in advance.
If you have in_code as a key in INVOICE then you could use INDEEXSEEK(). This does a seek without actually moving the file pointer (unless desired). This works especially if you have INvoice's order set to In_Code
SCAN
lnIn_Code = In_Code
If INDEXSEEK( lnIn_Code, .T., "Invoice", "In_Code")
SELECT Invoice
SCAN WHILE In_Code = lnIn_Code
do some code
ENDSCAN
SELECT sometable
EndIf
ENDSCAN
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.