Hi
I have a combo box where I select the item in it to populate a select box with the records of that type. When I click on the record in the select box it displays me the employee details like emp name, date trained of that particular item. I need t o add filter so where I can display only empnames who r trained between certain date.
I already wrote the code to pull up the empnames and date trained but i need to add the filter?
How to do that? Pls let me know
thank you. here is the part of the code
<form method="POST" name="TCForm" action="RptTrainingbyTypeCode.asp?menuid=<%=menuid%>&typeid=<%=TType%>">
<table cellspacing="0" cellpadding="0" width="900">
<td valign=" width="50%" top" width="138">
<font face="Arial, Helvetica, sans-serif"> <b>Training Type:</b> </font>
<td valign="top" width="762">
<SELECT name="TrainType" size="1" onchange="SubmitMe()">
<%
'Populate the drop down menu with training code names
response.write "<OPTION VALUE = -1> </OPTION>"
Do While NOT RST.EOF
if cint(RST("Training_Method_ID")) = TType then
Response.Write "<OPTION VALUE='" & RST("Training_Method_ID") & "' SELECTED>"
Response.Write RST("Training_Method_Text") & "</OPTION>"
else
Response.Write "<OPTION VALUE='" & RST("Training_Method_ID") & "'>"
Response.Write RST("Training_Method_Text") & "</OPTION>"
end if
RST.MoveNext
Loop
rst.close
set rst = nothing
%>
</SELECT>
<form method="POST" action="RptTrainingbyTypeCode.asp?menuid=<%=menuid%>&typeid=Request.querystring("typeid")&classid=Request.querystring("Class_ID")" name="frmAudit">
<font FACE="Trebuchet MS, Arial, Helvetica" size="2">
<b>
Start Date:</b></font> <!--webbot bot="Validation" S-Data-Type="String" B-Allow-Digits="TRUE" I-Maximum-Length="2" --><input type="text" name="BeginMonth" size="2" value=<%=Month(BDate)%> tabindex="1" maxlength="2" onchange="return CheckMonth(BeginMonth.value)">
/ <input type="text" name="BeginDay" size="2" value=<%=Day(BDate)%> tabindex="2" maxlength="2" onchange="return CheckDay(BeginDay.value)">
/ <input type="text" name="BeginYear" size="4" value=<%=Year(BDate)%> tabindex="3" maxlength="4" onchange="return CheckYear(BeginYear.value)">
<font FACE="Trebuchet MS, Arial, Helvetica" size="2"><b>End Date: </b></font><input type="text" name="EndDateMonth" size="2" value=<%=Month(Date)%> tabindex="4" maxlength="2" onchange="return CheckMonth(EndDateMonth.value)">
/ <input type="text" name="EndDateDay" size="2" value=<%=Day(Date)%> tabindex="5" maxlength="2" onchange="return CheckDay(EndDateDay.value)">
/ <input type="text" name="EndDateYear" size="4" value=<%=Year(Date)%> tabindex="6" maxlength="4" onchange="return CheckYear(EndDateYear.value)">
<input type="Submit" value=" Filter " name="BtnFilter" onClick()="RptTrainingbyTypeCode.asp?menuid=<%=menuid%>&typeid=Request.querystring("typeid")&classid=Request.querystring("Class_ID")>
</Table>
<Table>
<%
StartDate = request("BeginMonth") & "/" & request("BeginDay") & "/" & request("BeginYear")
Response.write request("BeginMonth")
'if len(StartDate) > 2 then
'Get date values entered in fields
'StartDate = DateValue(StartDate)
'EndDate = DateValue(request("EndDateMonth") & "/" & request("EndDateDay") & "/" & request("EndDateYear"))
EndDate= request("EndDateMonth") & "/" & request("EndDateDay") & "/" & request("EndDateYear")
'Set date values that are displayed on form
EDate = EndDate
BDate = StartDate
'end if
Response.write request.Form("BeginMonth")
Response.write request("EndDateMonth")
Response.write "gdgd"
strSQL = "SELECT employee.[Employee ID], employee.[First Name], employee.[Middle Name], employee.[Last Name], employee_training.Training_Method_ID, "
strSQL = strSQL & " employee_training.Train_ID, employee_training.Training_Date FROM "
strSQL = strSQL & "employee INNER JOIN employee_training ON employee.[Employee ID] = employee_training.Employee_ID "
strSQL = strSQL & "WHERE (((employee_training.Training_Method_ID)=" & TType & ") AND ((employee_training.Train_ID)=" & Class_ID & ")) ORDER BY employee.[Last Name], employee.[First Name], employee_training.training_date DESC;"
Set RST=Server.CreateObject("adodb.recordset")
rst.open strSQL, conn
if not rst.eof then
rst.MoveFirst
response.write "<tr><td><b><u>Employee Name</u></b></td><td align='center'><b><u>Date Trained</u></b></td><td><b><u>Employee Name</u></b></td><td align='center'><b><u>Date Trained</u></b></td></tr>"
CurrentName = -1
NameCount = 1
'Go through list and write information. Eliminate duplicates.
do while not rst.eof
if CurrentName <> rst("Employee ID") then 'Different Names. Print
if NameCount = 1 then
response.write "<tr>"
end if
Response.Write " <td width='200'>" & rst("First Name") & " " & rst("Middle Name") & " " & rst("Last Name") & "</td><td width='200' align='center'>" & rst("Training_Date") & "</td> "
if NameCount = 2 then
response.write "</tr>"
NameCount = 1
Else
NameCount = NameCount + 1
end if
CurrentName = rst("Employee ID")
' else Names are same. Do not print duplicates.
end if
rst.movenext 'Go to next record
loop
end if
rst.close
set rst = nothing
conn.close
set conn = nothing
end if
%>
I have a combo box where I select the item in it to populate a select box with the records of that type. When I click on the record in the select box it displays me the employee details like emp name, date trained of that particular item. I need t o add filter so where I can display only empnames who r trained between certain date.
I already wrote the code to pull up the empnames and date trained but i need to add the filter?
How to do that? Pls let me know
thank you. here is the part of the code
<form method="POST" name="TCForm" action="RptTrainingbyTypeCode.asp?menuid=<%=menuid%>&typeid=<%=TType%>">
<table cellspacing="0" cellpadding="0" width="900">
<td valign=" width="50%" top" width="138">
<font face="Arial, Helvetica, sans-serif"> <b>Training Type:</b> </font>
<td valign="top" width="762">
<SELECT name="TrainType" size="1" onchange="SubmitMe()">
<%
'Populate the drop down menu with training code names
response.write "<OPTION VALUE = -1> </OPTION>"
Do While NOT RST.EOF
if cint(RST("Training_Method_ID")) = TType then
Response.Write "<OPTION VALUE='" & RST("Training_Method_ID") & "' SELECTED>"
Response.Write RST("Training_Method_Text") & "</OPTION>"
else
Response.Write "<OPTION VALUE='" & RST("Training_Method_ID") & "'>"
Response.Write RST("Training_Method_Text") & "</OPTION>"
end if
RST.MoveNext
Loop
rst.close
set rst = nothing
%>
</SELECT>
<form method="POST" action="RptTrainingbyTypeCode.asp?menuid=<%=menuid%>&typeid=Request.querystring("typeid")&classid=Request.querystring("Class_ID")" name="frmAudit">
<font FACE="Trebuchet MS, Arial, Helvetica" size="2">
<b>
Start Date:</b></font> <!--webbot bot="Validation" S-Data-Type="String" B-Allow-Digits="TRUE" I-Maximum-Length="2" --><input type="text" name="BeginMonth" size="2" value=<%=Month(BDate)%> tabindex="1" maxlength="2" onchange="return CheckMonth(BeginMonth.value)">
/ <input type="text" name="BeginDay" size="2" value=<%=Day(BDate)%> tabindex="2" maxlength="2" onchange="return CheckDay(BeginDay.value)">
/ <input type="text" name="BeginYear" size="4" value=<%=Year(BDate)%> tabindex="3" maxlength="4" onchange="return CheckYear(BeginYear.value)">
<font FACE="Trebuchet MS, Arial, Helvetica" size="2"><b>End Date: </b></font><input type="text" name="EndDateMonth" size="2" value=<%=Month(Date)%> tabindex="4" maxlength="2" onchange="return CheckMonth(EndDateMonth.value)">
/ <input type="text" name="EndDateDay" size="2" value=<%=Day(Date)%> tabindex="5" maxlength="2" onchange="return CheckDay(EndDateDay.value)">
/ <input type="text" name="EndDateYear" size="4" value=<%=Year(Date)%> tabindex="6" maxlength="4" onchange="return CheckYear(EndDateYear.value)">
<input type="Submit" value=" Filter " name="BtnFilter" onClick()="RptTrainingbyTypeCode.asp?menuid=<%=menuid%>&typeid=Request.querystring("typeid")&classid=Request.querystring("Class_ID")>
</Table>
<Table>
<%
StartDate = request("BeginMonth") & "/" & request("BeginDay") & "/" & request("BeginYear")
Response.write request("BeginMonth")
'if len(StartDate) > 2 then
'Get date values entered in fields
'StartDate = DateValue(StartDate)
'EndDate = DateValue(request("EndDateMonth") & "/" & request("EndDateDay") & "/" & request("EndDateYear"))
EndDate= request("EndDateMonth") & "/" & request("EndDateDay") & "/" & request("EndDateYear")
'Set date values that are displayed on form
EDate = EndDate
BDate = StartDate
'end if
Response.write request.Form("BeginMonth")
Response.write request("EndDateMonth")
Response.write "gdgd"
strSQL = "SELECT employee.[Employee ID], employee.[First Name], employee.[Middle Name], employee.[Last Name], employee_training.Training_Method_ID, "
strSQL = strSQL & " employee_training.Train_ID, employee_training.Training_Date FROM "
strSQL = strSQL & "employee INNER JOIN employee_training ON employee.[Employee ID] = employee_training.Employee_ID "
strSQL = strSQL & "WHERE (((employee_training.Training_Method_ID)=" & TType & ") AND ((employee_training.Train_ID)=" & Class_ID & ")) ORDER BY employee.[Last Name], employee.[First Name], employee_training.training_date DESC;"
Set RST=Server.CreateObject("adodb.recordset")
rst.open strSQL, conn
if not rst.eof then
rst.MoveFirst
response.write "<tr><td><b><u>Employee Name</u></b></td><td align='center'><b><u>Date Trained</u></b></td><td><b><u>Employee Name</u></b></td><td align='center'><b><u>Date Trained</u></b></td></tr>"
CurrentName = -1
NameCount = 1
'Go through list and write information. Eliminate duplicates.
do while not rst.eof
if CurrentName <> rst("Employee ID") then 'Different Names. Print
if NameCount = 1 then
response.write "<tr>"
end if
Response.Write " <td width='200'>" & rst("First Name") & " " & rst("Middle Name") & " " & rst("Last Name") & "</td><td width='200' align='center'>" & rst("Training_Date") & "</td> "
if NameCount = 2 then
response.write "</tr>"
NameCount = 1
Else
NameCount = NameCount + 1
end if
CurrentName = rst("Employee ID")
' else Names are same. Do not print duplicates.
end if
rst.movenext 'Go to next record
loop
end if
rst.close
set rst = nothing
conn.close
set conn = nothing
end if
%>