I had a developer write this code. The resulting recordset is zero records. I know the data is there because I took out everything so it simply did a select * from the db and it displayed the records. I also know the fields for nanny_status and the city_filter have valid criteria because I did a response.write on the string variable str_filter and they showed the correct values as well as being in the access database.
below is the code: can you see anything wrong the sections pertaining to the str_filter.
<form name='filter_list' method=get action="preview_list.asp">
<input type="hidden" name="filter" value="<%= request("filter" %>">
Filter by City: <select name='city_filter'>
<option>Tampa</option>
<option>Orlando</option>
<option>Sarasota</option>
</select> <input type="submit" value="Filter">
</form>
<h2>Nanny List</h2>
<!-- This includes the DATABASE MAPPING file -->
<!-- #include file = "mapdb.asp" -->
<%
' Query the database and create a recordset
str_filter = ""
if (request("filter" <> "" then
str_filter = " WHERE nanny_status = '" & request("filter" & "'"
if (request("city_filter" <> "" then
str_filter = str_filter & " AND Department = '" & request("city_filter" & "'"
end if
end if
sqlstr = "SELECT * FROM nanny" & str_filter
SET rs = Conn.Execute(sqlstr)
WHILE NOT rs.eof
%>
below is the code: can you see anything wrong the sections pertaining to the str_filter.
<form name='filter_list' method=get action="preview_list.asp">
<input type="hidden" name="filter" value="<%= request("filter" %>">
Filter by City: <select name='city_filter'>
<option>Tampa</option>
<option>Orlando</option>
<option>Sarasota</option>
</select> <input type="submit" value="Filter">
</form>
<h2>Nanny List</h2>
<!-- This includes the DATABASE MAPPING file -->
<!-- #include file = "mapdb.asp" -->
<%
' Query the database and create a recordset
str_filter = ""
if (request("filter" <> "" then
str_filter = " WHERE nanny_status = '" & request("filter" & "'"
if (request("city_filter" <> "" then
str_filter = str_filter & " AND Department = '" & request("city_filter" & "'"
end if
end if
sqlstr = "SELECT * FROM nanny" & str_filter
SET rs = Conn.Execute(sqlstr)
WHILE NOT rs.eof
%>