Forums

This topic is locked

multisearch

Posted 30 Jul 2002 13:53:21
1
has voted
30 Jul 2002 13:53:21 Garo Maka posted:
I got a multisearch string atached to the recordset sql, I want it to filter through the 3 selects and the txtKeywords. Works fine except for...

... the textfield, it searches in 3 table fields. With OR it will not filter through the other 3 strings. With AND all the table fields will have to contain the keyword.

Any sugestions of how this txtkeyword can be filtered through the 3 selects?

Right now it looks like this:
<%
varWhereString = "WHERE BEHANDLER_ID <> -1 "

IF Request("selCat" <>"" Then
AndCatString = " AND KATEGORI LIKE '%" & Request("selCat" & "%' AND REG_APPROVED = Yes "
Else
AndCatString = ""
End If

IF Request("selAmt" <>"" Then
AndAmtString = " AND AMT LIKE '%" & Request("selAmt" & "%' AND REG_APPROVED = Yes "
Else
AndAmtString = ""
End If

IF Request("selKommune" <>"" Then
AndCityString = " AND CITY LIKE '%" & Request("selKommune" & "%' AND REG_APPROVED = Yes "
Else
AndCityString = ""
End If
<font color=green>
IF Request("txtKeywords" &lt;&gt;"" Then
AndtxtKeywordsString = " AND FIRMANAVN LIKE '%" & Request("txtKeywords" & "%' OR FIRMA_INFO LIKE '%" & Request("txtKeywords" & "%' OR KEYWORDS LIKE '%" & Request("txtKeywords" & "%' AND REG_APPROVED = Yes "
Else
AndtxtKeywordsString = ""
End If
</font id=green>

varWhereString = varWhereString & AndCatString & AndAmtString & AndCityString & AndtxtKeywordsString & " ORDER BY BEHANDLER_ID ASC"
%&gt;

Replies

Replied 31 Jul 2002 11:28:52
31 Jul 2002 11:28:52 Vince Baker replied:
you need to use brackets around the or values...

(field LIKE 'this' OR 2ndfield LIKE 'that') AND 3rdfield = 'the other'

Reply to this topic