Click to See Complete Forum and Search --> : help implementing a search facility


daksh
November 19th, 1998, 06:22 AM
Hi all !


i need to implement a search facility....for this i am asking a user to enter details in a text box...


PROBLEM


The backend should be able to take the string and based on what has been entered in the text box see if there are any "AND" , "OR" in the

string .....and then execute the query based on that ....

the code that i am using to find out the "and" or "OR" is

dim indkeywords(10)

k=1

for n=1 to len(keyword)

ch=mid(keyword,n,1)

indkeywords(k)=indkeywords(k) & ch

if ch="and" then k=k+1

else

if ch="or" then

k=k+1

end if

end if

next

but this doesn't find the "and" or "OR"


any ideas ..or if there is any other way of doing this ...i would very much appreciate the help


many thanks

daksh

daksh@interesource.co.uk

DragonDigital
November 19th, 1998, 07:30 AM
The first thing which strikes me is that you are comparing ch (1 character in length) with 'And' & 'Or', and not indKeywords.


Perhaps a better way would be to use 'InStr'. You could use this to find all the 'And' & 'Or's

Crazy D
November 19th, 1998, 07:32 AM
Why don't you use the InStr function? If it finds anything, then you can check to see if it's the operator or that it's part of the searchstring (I think that's easier then what you do now)