This is my asp page.
The first connection / recordset is what I want to page.
When it first loads I get the data, it is when I want to go to the next page is when the error appears ....
<%
Const adOpenForwardOnly = 0
Const adOpenKeyset = 1
Const adOpenDynamic = 2
Const adOpenStatic = 3
Const adLockReadOnly = 1
Const adLockPessimistic = 2
Const adLockOptimistic = 3
Const adLockBatchOptimistic = 4
Dim module
module = Request.Form("module"
Set Conn = Server.CreateObject("ADODB.Connection"

Set RS = Server.CreateObject("ADODB.RecordSet"

Conn.Open "Holding","edholding","edholding"
sql = "SELECT [RepGenA].[filename], [RepGenA].[UPN], [RepGenA].[Forename], [RepGenA].[surname],[RepGenA].[DOB] FROM RepGenA WHERE SUBSTRING(RepGenA.filename,4,4) = '"&module&"' AND DateofLeaving = '' "
RS.Open sql, Conn, adOpenKeyset,adLockReadOnly
TotalRows=RS.RecordCount
RS.PageSize = 10' Number of rows per page
PageSize=RS.PageSize
if Request("Action"

= "" Then
FormAction = " searchresultsschool.asp" 'NOTE This is the name of the current form.
end if
ScrollAction = Request("ScrollAction"

if ScrollAction <> "" Then
'Create Page Information
PageNo = mid(ScrollAction, 5)
if PageNo<1 Then
PageNo = 1
end if
else
PageNo = 1
end if
RS.AbsolutePage = PageNo
PageNumber=PageNo
TotalPages=RS.PageCount
%>
<html>
<head>
<title>Holding Database</title>
</head>
<BODY>
<%
if rs.eof then
Response.Write "No Records found, Please choose again."
else
%>
<%
Dim SearchTextcompany, MyConncompany, SQLcompany, RScompany
Set MyConncompany=Server.CreateObject("ADODB.Connection"

MyConncompany.Open "schoolsasp","schoolsasp","schoolsasp"
SQLcompany = "SELECT EstablishmentID, DfEE, EstablishmentName From Establishments WHERE DfEE = '"&module&"' ORDER BY EstablishmentName"
Set RScompany = MyConncompany.Execute(SQLcompany)
%>
<center>
<p BGCOLOR=#C7CFFD BORDERCOLOR=#000000 nowrap><FONT SIZE=+1 FACE="Arial" COLOR=#000000>Pupils in <%=Server.HTMLEncode(rscompany.Fields("EstablishmentName"

.Value)%> </FONT></p>
<%
RScompany.Close
MyConncompany.Close
Set RScompany = Nothing
Set MyConncompany = Nothing
%>
<FORM METHOD=POST ACTION="<%=FormAction%>" id=form2 name=form2>
<%Do while not (RS is nothing) %>
<TABLE BORDER=1>
<TR>
<TH BGCOLOR=lightblue BORDERCOLOR=#000000 nowrap><FONT SIZE=2 FACE="Arial" COLOR=#000000>UPN</FONT></TH>
<TH BGCOLOR=lightblue BORDERCOLOR=#000000 nowrap><FONT SIZE=2 FACE="Arial" COLOR=#000000>Forename</FONT></TH>
<TH BGCOLOR=lightblue BORDERCOLOR=#000000><FONT SIZE=2 FACE="Arial" COLOR=#000000>Surname</FONT></TH>
<TH BGCOLOR=lightblue BORDERCOLOR=#000000><FONT SIZE=2 FACE="Arial" COLOR=#000000>Date of Birth</FONT></TH>
</TR>
<%RowCount = rs.PageSize
Do While Not RS.EOF and rowcount>0%>
<TR VALIGN=TOP onMouseover="changeto('yellow')"
onMouseout="changeback('white')">
<a href="./moredetails.asp?G_id=<%=Server.HTMLEncode(rs.Fields("upn"

.Value)%>">
<TD BORDERCOLOR=#c0c0c0 nowrap><FONT SIZE=2 FACE="Arial" COLOR=#000000><%=RS("UPN"

%><BR></FONT></TD>
<TD BORDERCOLOR=#c0c0c0 nowrap><FONT SIZE=2 FACE="Arial" COLOR=#000000><%=RS("Forename"

%><BR></FONT></TD>
<TD BORDERCOLOR=#c0c0c0><FONT SIZE=2 FACE="Arial" COLOR=#000000><%=RS("Surname"

%><BR></FONT></TD>
<TD BORDERCOLOR=#c0c0c0><FONT SIZE=2 FACE="Arial" COLOR=#000000><%=RS("DOB"

%><BR></FONT></TD>
</TD></a>
</TR>
<%RowCount=RowCount-1
'Now we move to the next record in the recordset
RS.MoveNext
Loop%>
<P>
<%
'Now we set the result to the next recordset
set RS=RS.NextRecordSet
Loop
'Finally we close the connnection
Conn.Close
set RS=nothing
set Conn=nothing%>
</TABLE>
<INPUT TYPE="HIDDEN" NAME="sql" VALUE="<%=sql%>">
<%if PageNo>1 Then
'This code is for the button to go to the previous result, as you can see it starts when pageno=1, this is because on page 0 with the first 5 records, there is no previous result
%>
<INPUT TYPE="SUBMIT" NAME="ScrollAction" VALUE="<%="Page " & PageNo-1%>">
<%end if %>
<%'The following code is for the button to go the next result
if PageNo<TotalPages or (PageNo=1 and totalpages>1) Then %>
<INPUT TYPE="SUBMIT" NAME="ScrollAction" VALUE="<%="Page " & PageNo+1%>">
<%end if %>
</FORM>
</body>
</html>