vo***********@gmail.com wrote:
: Repost from an VB group.
: Hi All,
: I'm looking for a way to search for multiple words in a database.
: There is however one but. The words have to be within a certain range
: of each other.
: For example I would like to find records which contain the word MALE
: and within for example 10 words of it the word BROWN.
: My idea is to run a query finding the word MALE, and then with these
: records go and search for the word BROWN using Instr,
: but maybe there is an even easier way.
I think that this needs a little more explanation:
If your records contain more than one field, do you mean that
you want to find word distances within a single field? If not,
what do you actually mean by distance between words in different
fields?
You will need to specify exactly how to recognize a 'word': we
usually think of a 'word' as a series of alphabetic characters
surrounded by spaces on each end: but that's just the beginning.
Is Test77 a word? Is 77 a word? Is 'word' in 'word.' or
',word ' a word?
Then you will probably be able to write a VBA function that
gives a count of word pairs for each record; accumulate these into
a count over all records using a query that is well beyond the
level of anything that I could write -- but I'm sure people here will
be able to provide easier and clearer approaches.
BTW, once I got a string that I'm seeking pairs within, I'd
try to use the Split function to separate it into an array of
'words'. The separator on which to split would be somewhat
complex, though.
--thelma
: Marco