Hello,
I was wondering if someone could help me create a search function for my ASP page where it searches for specific information from fields RecordID, DateReceived, AgreementNumber, ReviewDate, Processor or DateReturned from the TRANSFER table in the TRANSFER database. I would like the search to pop up only relevant information in the listing. The code that I have so far is the following:
<!-- #include file=utils.inc -->
<html>
<head>
<!-- #include file ="fontCss.inc" -->
<title>Online Transfer Form</title>
</head>
<body>
<center><table width=75%>
<tr><td> <b>Records in TRANSFER</b><br></td></tr>
<% 'check if we need to display a message(if a record has been inserted,updated or deleted
select case request.querystring("s"
case "1"%>
<tr><td><font color=red size=1>Record added!</font></td></tr>
<%case "2"%>
<tr><td><font color=red size=1>Changes saved!</font></td></tr>
<%case "3"%>
<tr><td><font color=red size=1>Record removed!</font></td></tr>
<%end select%>
<tr><td><font color=red>+</font><a href=TRANSFERaddform.asp>Add record</a><br><br></td></tr>
<%'get the records!
strsql="select * from [TRANSFER]"
rs.open strsql,mydsn
'check for records!
if rs.eof and rs.bof then %>
<tr><td>No records!</td></tr>
<%else
'find what page we're on
If request.querystring("page"
= "" Then
pageno = 1
Else
pageno = request.querystring("page"
End If
rs.pagesize = 20
totalpages = CInt(rs.pagecount)
'sets recordsets current page
rs.absolutepage = pageno
If totalpages > 1 Then
'forward/next buttons
response.write"<tr><td>"
If pageno > 1 Then
response.write "<A href=TRANSFERlistAdmin.asp?page=" & pageno - 1 & ">previous</a> "
End If
If int(pageno) < int(totalpages) Then
response.write "<A href=TRANSFERlistAdmin.asp?page=" & pageno + 1 & ">next</a> "
End If
response.write("<BR>"
'write the page numbers
For A = 1 To totalpages
If Int(A) = Int(pageno) Then
Response.write "<font color=red>" & A & "</font> "
Else
Response.write "<A href=TRANSFERlistadmin.asp?page=" & A & ">" & A & "</font></a> "
End If
Next
response.write"</td></tr>"
End If %>
</table>
<table width="75%" cellpadding="5" cellspacing="0" border="0">
<tr bgcolor=#CCCCCC>
<td width=16% ><b>Record ID</b></td>
<td width=16% ><b>Date Received</b></td>
<td width=16% ><b>Agreement Number</b></td>
<td width=16% ><b>Review Date</b></td>
<td width=16% ><b>Processor</b></td>
<td width=16% ><b>Resubmission Received Date</b></td>
</tr>
<%x=0
'now display the records
bg=0
For x = 1 To 20
bg=bg+1
If rs.EOF Then
'we're at the end of the recordset so exit..
Exit For
Else
'do alternating row colors
doBg= bg mod 2
if dobg=0 then
strBg="#F7F7F7"
Else
strBg="#FFFFFF"
End if
'write the link to the detail screen %>
<tr bgcolor="<%=strbg%>">
<td width=16% ><a href=TRANSFERdetailAdmin.asp?id=<%=rs("RecordID"
%>&pageno=<%=pageno%>><%=rs("RecordID"
%></a></td>
<td width=16% ><a href=TRANSFERdetailAdmin.asp?id=<%=rs("RecordID"
%>&pageno=<%=pageno%>><%=rs("DateReceived"
%></a></td>
<td width=16% ><a href=TRANSFERdetailAdmin.asp?id=<%=rs("RecordID"
%>&pageno=<%=pageno%>><%=rs("AgreementNumber"
%></a></td>
<td width=16% ><a href=TRANSFERdetailAdmin.asp?id=<%=rs("RecordID"
%>&pageno=<%=pageno%>><%=rs("ReviewDate"
%></a></td>
<td width=16% ><a href=TRANSFERdetailAdmin.asp?id=<%=rs("RecordID"
%>&pageno=<%=pageno%>><%=rs("Processor"
%></a></td>
<td width=16% ><a href=TRANSFERdetailAdmin.asp?id=<%=rs("RecordID"
%>&pageno=<%=pageno%>><%=rs("DateReturned"
%></a></td>
</tr>
<%end if
rs.movenext
next
end if%>
<%'clean up!
rs.close
set rs=nothing%>
</table></center></body></html>
Please advise. Thank you.
Life is too short to waste...
Julius Pelejo
jcpelejo@hotmail.com
I was wondering if someone could help me create a search function for my ASP page where it searches for specific information from fields RecordID, DateReceived, AgreementNumber, ReviewDate, Processor or DateReturned from the TRANSFER table in the TRANSFER database. I would like the search to pop up only relevant information in the listing. The code that I have so far is the following:
<!-- #include file=utils.inc -->
<html>
<head>
<!-- #include file ="fontCss.inc" -->
<title>Online Transfer Form</title>
</head>
<body>
<center><table width=75%>
<tr><td> <b>Records in TRANSFER</b><br></td></tr>
<% 'check if we need to display a message(if a record has been inserted,updated or deleted
select case request.querystring("s"
case "1"%>
<tr><td><font color=red size=1>Record added!</font></td></tr>
<%case "2"%>
<tr><td><font color=red size=1>Changes saved!</font></td></tr>
<%case "3"%>
<tr><td><font color=red size=1>Record removed!</font></td></tr>
<%end select%>
<tr><td><font color=red>+</font><a href=TRANSFERaddform.asp>Add record</a><br><br></td></tr>
<%'get the records!
strsql="select * from [TRANSFER]"
rs.open strsql,mydsn
'check for records!
if rs.eof and rs.bof then %>
<tr><td>No records!</td></tr>
<%else
'find what page we're on
If request.querystring("page"
pageno = 1
Else
pageno = request.querystring("page"
End If
rs.pagesize = 20
totalpages = CInt(rs.pagecount)
'sets recordsets current page
rs.absolutepage = pageno
If totalpages > 1 Then
'forward/next buttons
response.write"<tr><td>"
If pageno > 1 Then
response.write "<A href=TRANSFERlistAdmin.asp?page=" & pageno - 1 & ">previous</a> "
End If
If int(pageno) < int(totalpages) Then
response.write "<A href=TRANSFERlistAdmin.asp?page=" & pageno + 1 & ">next</a> "
End If
response.write("<BR>"
'write the page numbers
For A = 1 To totalpages
If Int(A) = Int(pageno) Then
Response.write "<font color=red>" & A & "</font> "
Else
Response.write "<A href=TRANSFERlistadmin.asp?page=" & A & ">" & A & "</font></a> "
End If
Next
response.write"</td></tr>"
End If %>
</table>
<table width="75%" cellpadding="5" cellspacing="0" border="0">
<tr bgcolor=#CCCCCC>
<td width=16% ><b>Record ID</b></td>
<td width=16% ><b>Date Received</b></td>
<td width=16% ><b>Agreement Number</b></td>
<td width=16% ><b>Review Date</b></td>
<td width=16% ><b>Processor</b></td>
<td width=16% ><b>Resubmission Received Date</b></td>
</tr>
<%x=0
'now display the records
bg=0
For x = 1 To 20
bg=bg+1
If rs.EOF Then
'we're at the end of the recordset so exit..
Exit For
Else
'do alternating row colors
doBg= bg mod 2
if dobg=0 then
strBg="#F7F7F7"
Else
strBg="#FFFFFF"
End if
'write the link to the detail screen %>
<tr bgcolor="<%=strbg%>">
<td width=16% ><a href=TRANSFERdetailAdmin.asp?id=<%=rs("RecordID"
<td width=16% ><a href=TRANSFERdetailAdmin.asp?id=<%=rs("RecordID"
<td width=16% ><a href=TRANSFERdetailAdmin.asp?id=<%=rs("RecordID"
<td width=16% ><a href=TRANSFERdetailAdmin.asp?id=<%=rs("RecordID"
<td width=16% ><a href=TRANSFERdetailAdmin.asp?id=<%=rs("RecordID"
<td width=16% ><a href=TRANSFERdetailAdmin.asp?id=<%=rs("RecordID"
</tr>
<%end if
rs.movenext
next
end if%>
<%'clean up!
rs.close
set rs=nothing%>
</table></center></body></html>
Please advise. Thank you.
Life is too short to waste...
Julius Pelejo
jcpelejo@hotmail.com