LPARAMETERS tcString IF VARTYPE(m.tcString) <> 'C' RETURN -1 ENDIF LOCAL lnI, lnRec, lcString lcString = LOWER(m.tcString) lnRec = 0 SCAN REST WHILE m.lnRec = 0 FOR lnI = 1 TO FCOUNT() && assuming table is open in the current workarea IF INLIST(TYPE(FIELD(m.lnI)), 'C', 'M') IF m.lcString $ LOWER(EVALUATE(FIELD(m.lnI))) lnRec = RECNO() EXIT ENDIF ENDIF ENDFOR ENDSCAN IF m.lnRec#0 GO m.lnRec ENDIF RETURN m.lnRecRun once, there is little difference, but we never run things once! ;)
>lparameters lcString >if vartype(lcString) <> 'C' > return -1 >endif >local llFound, lnI, lnRec >for lnI = 1 to fcount() && assuming table is open in the current workarea > if inlist(type(field(lnI)), 'C', 'M') > lcField = FIELD(lnI) > locate for lower(lcString) $lower(&lcField) > if not eof() > llFound = .t. > exit > endif > endif >endfor >lnRec = 0 >if llFound > lnRec = RecNo() >endif >return lnRec