* Method One, which you described above. procedure flImport1 parameters pcSource, pcTarget, pcCriteria private all like l* lnFpRead = fopen(pcSource) if lnFpRead == -1 messagebox("Error opening source file.") return(.F.) endif lnFpWrite = fcreate(pcTarget) if lnFpWrite == -1 = fclose(lnFpRead) messagebox("Error opening target file.") return(.F.) endif llFailed = .F. do while not feof(lnFpRead) and not llFailed lcLine = fgets(lnFpRead) if lower(pcCriteria) $ lower(lcLine) if fputs(lnFpWrite, lcLine) == 0 llFailed = .T. endif endif enddo = fclose(lnFpRead) = fclose(lnFpWrite) * I showed above how to read and write to two files just so you know * how for future use. However, the better method would be to instead * replace the fputs() above with an INSERT INTO TABLE VALUES ( lcLine ) * where the table would have a simple memo field for example. This would * accomodate very long lines where as your append from will only work * up to 254 character field line lengths due to limitations in VFP tables. * * If the file you are reading in has less than 254 characters/line ALWAYS, * then you should use Method Two below since its obviously easier. endif return(llFailed) * Method Two, faster and easier. procedure flImport2 parameters pcSource, pcCriteria private all like l* create cursor import ( line char(254) ) append from (pcSource) delimited delete for lower(pcCriteria) $ lower(line) * Results are already in temporary cursor tabled called "import" * Usage later: * scan for not deleted() * ... * blah blah blah * ... * ... * endscan returnPlease beware that I didnt test the above code. :-)