473,396 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

best way to search for multiple words through a query

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.

Marco

Jul 29 '06 #1
5 4997
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

Jul 29 '06 #2
RegExp. Look up Regular Expressions. That would probably be easier,
once you get the hang of it. And *much* less code.

Jul 29 '06 #3
I have more than one field.
I want to search in text and memo fields of a table.
If a field is a textfield than within that textfield the words should
be within n word.
In the memofield the same.

Can you give me an example for RegExp how to do this?

Marco
pi********@hotmail.com schreef:
RegExp. Look up Regular Expressions. That would probably be easier,
once you get the hang of it. And *much* less code.
Jul 29 '06 #4
vo***********@gmail.com wrote:
I have more than one field.
I want to search in text and memo fields of a table.
If a field is a textfield than within that textfield the words should
be within n word.
In the memofield the same.

Can you give me an example for RegExp how to do this?
You need to learn how to use GoogleGroups.
Goto http://groups.google.com/advanced_search?hl=en and enter
*Access*
in the "return from group" textbox. And of course, enter some search
words...in your case RegExp.

>
Marco
pi********@hotmail.com schreef:

>>RegExp. Look up Regular Expressions. That would probably be easier,
once you get the hang of it. And *much* less code.

Jul 29 '06 #5

salad wrote:
<SNIP>
You need to learn how to use GoogleGroups.
Goto http://groups.google.com/advanced_search?hl=en and enter
*Access*
in the "return from group" textbox. And of course, enter some search
words...in your case RegExp.
</SNIP>

Ay-man!

Jul 30 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: dpg | last post by:
How do site searches work? I want to create a MySQL database with a field called "keywords". Then a form with a search phrase input box. I can't figure how to get the results with multiple...
0
by: Phil Powell | last post by:
The table already has a fulltext index and from there I can use the MySQL fulltext search query to get results as well as the relevancy score. The problem I have is that MySQL has a default...
0
by: Robert Oschler | last post by:
I read a while back that MySQL will only use one index per query. (If this is not so, please tell me and point me to a doc that gives a good explanation of MySQL's current index usage policy). ...
83
by: D. Dante Lorenso | last post by:
Trying to use the 'search' in the docs section of PostgreSQL.org is extremely SLOW. Considering this is a website for a database and databases are supposed to be good for indexing content, I'd...
5
by: JP SIngh | last post by:
Hi All This is a complicated one, not for the faint hearted :) :) :) Please help if you can how to achieve this search. We have a freetext search entry box to allow users to search the...
3
by: Michael | last post by:
Hi, I have not implimented a search feature yet for a web site yet and wanted to get some advice. Most of the search tips I have seen so far only deal with searching html files or other web files....
1
by: Reef81 | last post by:
Does anyone know a way to have the search parameters displayed in the query or report? For example, if I set up a parameter to search all entries in my table, is there a way to have the search...
3
by: Redbeard | last post by:
Hi All this is my first time post, be gentle. I am looking at creating a keyword search that searches multiple fields in a Form and then filters records that match the keyword. The Form...
13
by: Robertf987 | last post by:
Hi, Yet another thing I need help with I'm affraid. I'll first explain what I want, then I'll try to explain what I have. I'm using Microsoft Access 2000. What I want is to be able to do a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.