The only problem with your code, is that it is not optimizable, but for a relatively small table the speed may be acceptable.
s
>The code:
>
>lcExact=SET('EXACT')
>SET EXACT OFF
>LOCATE FOR field1=trim(cField1) and field2=trim(cField2) and field3=trim(cField3);
> and field4=trim(cField4) and field5=trim(cField5)
>SET EXACT &lcExact
>
>allows for searches that "begins with" the entered text only. I have found that a "contains text" search is broader and allows for partials:
>
>LOCATE FOR ATC(ALLTRIM(cField1),field1)>0 and ;
> ATC(ALLTRIM(cField2),field2)>0 and ;
> ATC(ALLTRIM(cField3),field3)>0 and ;
> ATC(ALLTRIM(cField4),field4)>0 and ;
> ATC(ALLTRIM(cField5),field5)>0
>
>To allow for multiple record matches, you can use a SELECT or a SCAN-ENDSCAN (and collect the record pointers to the matches). The and clause above requires all fields to match; if any field match can be a possiblity, then use an or clause.