Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search general field

Status
Not open for further replies.

gattabria

Programmer
Jul 17, 2004
26
US
I have table with a general field that stores a Microsoft Word document. The table has thousands of records. How do I search for a single word or phrase within the general field without having to open each record one at a time?
 
I don't think so. You'd be much better off storing the word docs in a memo field and extracting them with strtofile() as needed. Then they could be easily searched with a LOCATE/SCAN for.

Alternatively, leave the docs in folders and store only the path in the DBF. You can search files with low level file reads if you need speed and scalability, of filetostr() is the docs are small and speed isn't a primary concern.

In general using general fields is asking for trouble later since they are not easily extracted or manipulated.

Brian
 

Gattabria,

As Brian has said, you can't directly search Word docs stored in general fields.

If the documents are fairly static, you could consider creating a new memo field, alongside the existing general field, to hold only the text of the document (as opposed to formatting, graphics, etc.). You can populate this field using some simple Automation code (REPLACE TextMemo WITH oDoc.Content.Text). Then, use VFP's normal string-handling functions to search the field.

Of course, you'd then have the problem of keeping that field up to date, plus the searching would in any case be slow.

Another approach might be to use Word itself to do the searching. I don't know how to do it, but it should be possible, using Automation, to open each document in turn and have Word search it.

Hope this helps.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top