mastcus->ccust = "11111" or ...
Seems you use old foxbase syntax for alias->field. Now you could cut it to "mastcus.ccust" to save one char per alias.field and furthere cut it to just "ccust" saving 8 more chars per expression.ccust = "1111" && would be same as mastcus->ccust = "1111"Well of course still it doesn't let you achieve the intended result. Now let's cut it more :
where mastcus->CCUST="03118" or mastcus->CCUST="03335" or mastcus->CCUST="03770" * Could be written as where ccust in ("03118","03335","03770")So far so good, but still too cumbersome to accomplish task (if ever SQL wouldn't complain as "expression too complex"). I don't believe you write all those 100+ cust ids by hand. You should be collecting them via an interface, a multiselect combo, grid or whatever. In most you could insert them to a cursor as Kamal nicely suggested and your SQL cuts down in length and maintanence dramatically. Suppose you collect them via multiselectgrid class (in files\classes section - I don't mean to force you use it) the SQL would cut to :
* Assuming selector is thisform.multiselectgrid1 * It could be a modal selector form select (your empty list here,*) from (thisform.multiselectgrid1.recorsource) ; where lSelected into cursor mastrepoCetin