There are several ways of doing this. One method is to pass a variable back to the same page that returns your results with the page number such as. .
getresults.asp?pn=2 (where getresults.asp contains the results and pn equals your page number.)
multiply pn by the number of results you want to display.
In your WHILE NOT rs.EOF ... WEND loop count the records returned by adding 1 to the variable after movenext. Add a conditional to check to see if the variable falls on the page. Once all the results of that page have been retrieved Use Exit While to end the loop.
such as:
Code:
<%
PageNumber=request.querystring("pn")
if PageNumber = 0 then
PageNumber=1
end if
NoPerPage=4 ' number of record per page
RecordMin=(((PageNumber-1) * NoPerPage)+1) 'starting number of results
if RecordMin < 1 then
RecordMin=1
end if
RecordMax=PageNumber * NoPerPage 'ending number of results
oConn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & dbPath)
Set objRS = CreateObject("ADODB.Recordset")
objRS.Open sSQL, oConn
RC=1
do while not objRS.EOF
if RC >= RecordMin and RC <= RecordMax then
%><% 'Display your results here
end if
objRS.movenext
RC=RC+1
if RC > RecordMax then
exit do
end if
loop
'put page links here
if PageNumber > 1 then
%>
<a href="results.asp?pn=<%=PageNumber-1%>"><<Prev</a>
<%
End if
if not objRS.EOF
%>
<a href="results.asp?pn=<%=PageNumber+1%>">Next>></a>
<%
End if
objRS.close
oConn.close
set objRS = nothing
set oConn = nothing
%>