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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Keyword Search

Status
Not open for further replies.

struth

Programmer
Joined
Aug 26, 2001
Messages
114
Location
GB
How can I turn this search that returns a single keyword into one that accepts multiple ones (at least 2 or 3)? Tried all kind of things like 'split' but it's not working.

<%
Dim rsProviderActQuery__MMColParam
rsProviderActQuery__MMColParam = &quot;%&quot;
if (Request.Form(&quot;searchbox&quot;) <> &quot;&quot;) then rsProviderActQuery__MMColParam = Request.Form(&quot;searchbox&quot;)
%>
<%
set rsProviderActQuery = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsProviderActQuery.ActiveConnection = MM_GW_providers_STRING
rsProviderActQuery.Source = &quot;SELECT * FROM SupplierActivityQuery WHERE SupplierActivityDescription LIKE '%&quot; + Replace(rsProviderActQuery__MMColParam, &quot;'&quot;, &quot;''&quot;) + &quot;%'&quot;
rsProviderActQuery.CursorType = 0
rsProviderActQuery.CursorLocation = 2
rsProviderActQuery.LockType = 3
rsProviderActQuery.Open()
rsProviderActQuery_numRows = 0
%>

tia
Struth
 
when you tried split() did you rebuild rsProviderActQuery__MMColParam into &quot;xx OR yy&quot; string? Live long and make your kids suffer..
 
Darn it I blew it away ... but I tried something like this...

Dim myArr, sqlstring
myArr = split(Request.Form(&quot;searchbox&quot;),&quot;&quot;)
sqlstring = &quot;select * from SupplierActivityQuery WHERE&quot;
sqlstring = sqlstring & &quot;SupplierActivityDescription like '%&quot; & myArr(0) & &quot;%' &quot;
for i=1 to ubound(myArr)
sqlstring = sqlstring & &quot;OR SupplierActivityDescription like '%&quot; & myArr(i) & &quot;%' &quot;

Then tried to connect this all up with rsProviderActQuery until I felt like doing myself a mischief!

No kids but I'm being very nice to my nieces and nephews - but as anybody who has anything to do with IT says &quot;will it work?&quot;

TIA
Struth
 
myArr = split(Request.Form(&quot;searchbox&quot;),&quot;&quot;)

should be

myArr = split(Request.Form(&quot;searchbox&quot;),&quot; &quot;)

but that should work, might be worth putting an

If uBound(myArray) > 0 Then

do string add code

bets advice is chuck it into your page and see if it works!
Live long and make your kids suffer..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top