Search method.... 
Author Message
 Search method....

Hi all. I have a problem which I am being faced with, and
that is new to my short career as an Access developer.
here's the problem: I need a way to search for multiple
fields from a text box for example at the same time,
separated by semicolon(;). For example: I want to search
for all companies in US and CANADA and I enter:

US;CANADA

and it gives me all the companies from those two
countries. Now I created an excellent function that
searches by asteric(*), by I cannot come up(yet)with a
solution to the semicolon. I just know at this point what
I'd like my function to do. If it encounters the semicolon
(;) then it would look at US(from the above example) as
one string to search for, and It would start and rebuild a
new string starting with the first word after the semicolon
(;), in this case CANADA, and so on and so forth,
therefore building the string to either filter or search
lik this:
Where 'Country' Like 'US' and(Or) 'Country' Like 'CANADA'.
I
just do not know yet how to implement it. I am trying to
Split it or Use InStr, but to no success so far. Any help
or code snippet would be greately appreciated. I am runing
on a tight deadline. Thank you.
~Leo~



Sun, 01 Aug 2004 23:07:21 GMT  
 Search method....
Replace each semicolon with "," including the quotes.
Add leading and trailing double quotes.
Use the In() operator on the result.

You'll end up with a SQL clause like this:
    WHERE Country In ("US","Canada","Australia")

--
Allen Browne, Microsoft MVP (Most Valuable Professional)
Perth, Western Australia
Tips for MS Access users at:
    http://users.bigpond.net.au/abrowne1


Quote:
> Hi all. I have a problem which I am being faced with, and
> that is new to my short career as an Access developer.
> here's the problem: I need a way to search for multiple
> fields from a text box for example at the same time,
> separated by semicolon(;). For example: I want to search
> for all companies in US and CANADA and I enter:

> US;CANADA

> and it gives me all the companies from those two
> countries. Now I created an excellent function that
> searches by asteric(*), by I cannot come up(yet)with a
> solution to the semicolon. I just know at this point what
> I'd like my function to do. If it encounters the semicolon
> (;) then it would look at US(from the above example) as
> one string to search for, and It would start and rebuild a
> new string starting with the first word after the semicolon
> (;), in this case CANADA, and so on and so forth,
> therefore building the string to either filter or search
> lik this:
> Where 'Country' Like 'US' and(Or) 'Country' Like 'CANADA'.
> I
> just do not know yet how to implement it. I am trying to
> Split it or Use InStr, but to no success so far. Any help
> or code snippet would be greately appreciated. I am runing
> on a tight deadline. Thank you.
> ~Leo~



Sun, 01 Aug 2004 23:34:14 GMT  
 Search method....
Allen. Thank you. I have made this very complicated query,
and It isn't producing the right results. Let me try your
solution. Thanks again.


Mon, 02 Aug 2004 00:46:05 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. locking errors and/or VBA- based Record Searching method

2. Fast Search Method Needed

3. In need of a good DB search method

4. Any faster search method beside FindFirst?

5. q: Need super fast string search method...

6. API search method.

7. Help with Searching Method

8. VB 3.0 Searching Method

9. Search method in VBScript

10. Help with search method - VB5/6

11. ado search method

12. File Search method? (3rd Post!)

 

 
Powered by phpBB® Forum Software