Hi Matt,
As you say atleast one of those 3 criteria would be imposed always. It could be removed(1=0) and used as below.
Code:
SQL = "Select DISTINCT products.ID, products.description,Products.forder FROM products LEFT OUTER JOIN ProductProfiles ON products.id = productprofiles.productId " & _
"LEFT OUTER JOIN users ON productProfiles.prodManager = users.ID "
sql = sql & " AND productProfiles.RegionID = " & IRegion & " AND "
Dim strWhere
strWhere = ""
if request.form("pn") = "on" then
strWhere = strWhere & " (Products.description LIKE '%" & SearchString & "%') "
end if
if request.form("sd") = "on" then
if len(strWhere) > 0 then strWhere = strWhere & " OR "
strWhere = strWhere & " (ProductProfiles.Description LIKE '%" & SearchString & "%') "
end if
if request.form("nd") = "on" then
if len(strWhere) > 0 then strWhere = strWhere & " OR "
strWhere = strWhere & " (Products.natDescription LIKE '%" & SearchString & "%') "
end if
sql = sql & " ORDER BY Products.forder"
I haven't tested this. This might need slight alterations if needed.
Hope that helps.
Cheers!
_________________________
- Vijay G
Strive for Perfection