>>seek nCustNum
>>copy to test_table1 while CustNum = nCustNum
I meant to say that this would even be faster than SQL on a large table but only if all the records you need are sequential [which they probably are]. You are already at the first record of the group. The COPY WHILE will stop as soon as the WHILE is false.
Off topic: If you need to look for a particular record in a specific group of records you can LOCATE FOR WHILE. In an example of invoice lineitems where my order is invoice number.
SEEK nInvoiceNum
locate for item_no = 100101 while Invoice = nInvoiceNum
This will only search the next N records that have Invoice = nInvoiceNum
Mark McCasland
Midlothian, TX USA