I am trying to filter out records based on a keyword in a string. so here is what I am doing:
If Trim(Request("C_Type")) <> "" Then sFilter = "[Career Type] LIKE '%" & (Request("C_Type")) & "%'" Else sFilter = "" End If
If Trim(Request("E_Type")) <> "" Then sFilter = "[Employment Type] LIKE '%" & (Request("E_Type")) & "%'" Else sFilter = "" End If Now when I pass the string it gives me all the records no matter what! Now if I only have one filter in the page it works fine. Why is it that when I have those 2 filters nothing works?
I'm slightly new to ASP, but don't you have to use the "WHERE" keyword or else it will return ALL records?
One question about your search: is that a nested filter? i.e. you can filter out the career types and then filter the employment types of those returns? Are values going to be passed to both C_Type and E_Type at the same time? Perhaps if I had a better understanding of what the form looks like that you're getting the variables from...do you have a link for the form that you're using?
Thanks allot it worked after I made a few alterations:
If Trim(Request("E_Type")) <> "" Then If len( sFilter ) > 0 Then sFilter = sFilter & " OR " sFilter = "[Employment Type] LIKE '%" & (Request("E_Type")) & "%'" Else sFilter = "" End If End If