>>What is the index expression for your table?
>
>Not sure what you mean by that but the order is:
>
>Set Order To RGDSNum && RTE_NO + RTE_LET + DIRECTN + STR(SEQNO,4) + STR(NUMBER,3)
An index doesn't need to be active in order to be used for optimization - although optimization is supposed to work best if NO index order is set.
If you have this index, the WHERE clause, or part of it, must match it in order to use this index for optimization. Assuming you have the appropriate variables:
SELECT ...;
WHERE RTE_NO + RTE_LET + DIRECTN + STR(SEQNO,4) + STR(NUMBER,3);
= m.rte_no + m.rte_let + m.directn + str(m.seqno,4) + str(m.number,3);
...
On the other hand, if you already have this index active, it might be faster to just SEEK for the correct record. If there can be more than one matching record, something like this:
if seek (m.rte_no + m.rte_let...)
scan while rte_no + rte_let ... = m.rte_no + m.rte_let...
endscan
endif
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)