<%
Option Explicit
Dim DBName, objConn, objRS, strSQL, Cat, Search
Dim icount
icount = 0
DBName = server.mappath("DB/orders.mdb")
Cat = Request.Form( "cat" )
Search = Request.Form( "searchf" )
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "DBQ=" & DBName & ";Driver={Microsoft Access Driver (*.mdb)};"
Set objRS = Server.CreateObject("ADODB.Recordset")
objConn.objRS.Open
IF len(Search) <> 0 Then
Select Case Cat
Case "Due Date"
strSQL = "SELECT * FROM Tasks WHERE Tasks.[Due Date] LIKE '%" & Search & "%' ORDER BY Due Date DESC"
Set objRS= objConn.execute(strSQL)
Case "Category"
strSQL = "SELECT * FROM Tasks WHERE Tasks.Category LIKE '%" & Search & "%' ORDER BY Due Date DESC"
Set objRS= objConn.execute(strSQL)
Case "Responsible Person - Name"
strSQL = "SELECT * FROM Tasks WHERE Tasks.[Responsible Person - Name] LIKE '%" & Search & "%' ORDER BY Due Date DESC"
Set objRS= objConn.execute(strSQL)
End Select
Else
Response.Write "No Value Entered"
Response.Redirect "Default.asp"
End If
%>
<html>
<head>
<title>Search Results</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="css/admin.css" type="text/css">
<script language="JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<body bgcolor="#ecece4" text="#000000">
<% If objRS.BOF and objRS.EOF Then %>
<font size="2" face="Arial, Helvetica, sans-serif"><b><font color="#FF0000">No
Records Found</font></b></font>
<% Else %>
<form name="form1" class="normaltxt">
<table width="100%" border="0" cellspacing="4" cellpadding="0">
<tr>
<td width="33%" class="normaltxt">Status:
<select name="menu1" onChange="MM_jumpMenu('parent',this,0)" class="normaltxt">
<option value="orderreport.asp?SORT=1&STATUS=ALL" selected>All</option>
<option value="orderreport.asp?SORT=2&STATUS=OPEN" >Open</option>
<option value="orderreport.asp?SORT=3&STATUS=CLOSED" >Complete</option>
</select>
</td>
<td width="33%" class="normaltxt">Sort By:
<select name="menu3" onChange="MM_jumpMenu('parent',this,0)" class="normaltxt">
<option value="orderreport.asp?SORT=1&STATUS=ALL">Due Date</option>
<option value="orderreport.asp?SORT=9&STATUS=ALL" selected>Weeks Before Shutdown/option>
<option value="orderreport.asp?SORT=10&STATUS=ALL">Category</option>
<option value="orderreport.asp?SORT=11&STATUS=ALL">Responsible Person - Name</option>
</select>
</td>
<td width="33%" class="normaltxt"> </td>
</tr>
</table>
</form>
<table width="795" border="0" cellspacing="0" cellpadding="1" bgcolor="#003366">
<tr>
<td>
<table width="114%" border="0" cellspacing="1" cellpadding="3" class="BlkTextStd">
<tr bgcolor="#FFCC66">
<td class="headers1" width="43" height="19">Due Date</td>
<td class="headers1" width="63" height="19">Weeks Before Shutdown</td>
<td class="headers1" width="49" height="19">Category</td>
<td class="headers1" width="496" height="19">Tasks</td>
<td class="headers1" width="52" height="19">Responsible Person - Title</td>
<td class="headers1" width="47" height="19">Responsible Person - Name</td>
</tr>
<%
While NOT objRS.EOF
If Eval(icount\2 = icount/2) Then
color = "#ecece4"
ELSE
color = "#fdfdfc"
END IF
%>
<TR BGCOLOR=<%= color %>>
<td class="normaltxt" width="43"> <%= objRS("Due Date") %></td>
<td class="normaltxt" width="63"> <a href="process.asp?ID=<%= objRS("OrderID") %>"><%= objRS("Weeks before Shutdown") %></a> </td>
<td class="normaltxt" width="49"> <%= objRS("Catergory") %> </td>
<td class="normaltxt" width="496"> <%= objRS("Tasks") %> </td>
<td class="normaltxt" width="52"> <%= objRS("Responsible Person - Title") %> </td>
<td class="normaltxt" width="47"> <%= objRS("Responsible Person - Name") %> </td>
</tr>
<%
icount=icount+1
objRS.MoveNext
Wend
'objRS.Close
%>
</table>
</td>
</tr>
</table>
</body>
</html>
<% End IF %>