I've got paging implemented to limit each page to 8 records. If (for example) my results are 5 pages long, pages 1-4 work fine, and page 5 gives me the error below. Also, if my results only produce 1 page, I immediately get the error below:
"ADODB.Field (0x80020009)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record."
Help!
Code (HTML truncated for readability)
<!-- #include file="../adovbs.inc" -->
<%
Dim iPageSize
Dim iPageCount
Dim iPageCurrent
Dim strSQL
Dim objPagingRS
Dim iRecordsShown
Dim I
Dim Recnum
Recnum = Request("Recnum")
iPageSize = 8
' Open DB and Set Password
Dim adoCon
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("../sterilization.mdb")
' Create the Recordset
Set objPagingRS = Server.CreateObject("ADODB.Recordset")
objPagingRS.PageSize = iPageSize
objPagingRS.CursorLocation = adUseClient
objPagingRS.CacheSize = iPageSize
' Select Records
strSQL = "SELECT * FROM PartShipForm WHERE Sterile_Lot_Number = '" & RecNum & "'"
objPagingRS.Open strSQL, adoCon
' Page number
If Request.QueryString("page") = "" Then
iPageCurrent = 1
Else
iPageCurrent = CInt(Request.QueryString("page"))
End If
' Page Count
iPageCount = objPagingRS.PageCount
' No records found
If iPageCount = 0 Then
Response.Write "No records found!"
Else
' Move to the selected page
objPagingRS.AbsolutePage = iPageCurrent
' Page Header
%>
<html>
<head>
<title>TX8391 Sterilization Tracking Log Database</title>
<link rel="stylesheet" href="../style.css" type="text/css">
</head>
<body>
<% ' Detail header %>
<table class="detail" width="760" border=1>
<tr>
<td width="100" align="center"><span class=btext>Quantity</span></td>
<td width="500" align="left"><span class=btext> Product Code/Description (to appear on certificate)</span></td>
<td width="160" align="center"><span class=btext>Lot Number</span></td>
</tr>
<%
' Detail Rows
iRecordsShown = 0
Do While iRecordsShown < iPageSize And Not objPagingRS.EOF
%>
<tr>
<td width="100" align="center"><span class=text> <% Response.Write objPagingRS("Quantity") %></span></td>
<td width="500" align="left"><span class=text> <% Response.Write objPagingRS("Product_Name") %></span></td>
<td width="160" align="center"><span class=text> <% Response.Write objPagingRS("Packaging_Lot_Number") %></span></td>
</tr>
<%
' Increment the number of records we've shown & move to next record
iRecordsShown = iRecordsShown + 1
objPagingRS.MoveNext
Loop
' Shipping Footer
%>
</table>
<table width="760">
<tr>
<td width="200" align="right" class="thick"><span class=text>TOTAL </span></td>
<td width="560" align="right" class="thick"><span class=text>Circle One: PRODUCTION / TEST </span></td>
</tr>
<tr>
<td colspan="2" align="left"><span class=size5>Any change from your standard dose parameter, box dimensions or density must be advised in writing and could require dose<br>
mapping. If a dose map is performed there may be a charge associated with this service.</span></td>
</tr>
</table>
<% ' Footer %>
<table width="760">
<tr>
<td align="left"><span class=text>F001888 Ver E.<br> Form, Production</span></td>
<td align="right" valign="top"><span class=text>Page <%= iPageCurrent %> of <%= iPageCount %><br>
<a href="../index.asp">Home</a>
<%
If iPageCurrent > 1 Then
%>
<a href="view_ship_gammatrbl.asp?page=<%= iPageCurrent - 1 %>&Recnum=<%= Recnum%>">[<< Prev]</a>
<%
End If
' Page numbers:
For I = 1 To iPageCount
If I = iPageCurrent Then
Response.Write ("")
Else
%>
<a href="view_ship_gammatrbl?page=<%= I %>&Recnum=<%= Recnum%>"><%= I %></a>
<%
End If
Next 'I
If iPageCurrent < iPageCount Then
%>
<a href="view_ship_gammatrbl?page=<%= iPageCurrent + 1 %>&Recnum=<%= Recnum%>">[Next >>]</a>
<%
End If
%>
</span></td>
</tr>
<tr>
<td colspan=2 align="center"><span class=text><i>This confidential document...</i></span></td>
</tr>
</table>
</body>
</html>
<% End If
' Close DB Objects
objPagingRS.Close
Set objPagingRS = Nothing
adoCon.Close
Set adoCon = Nothing
%>
"ADODB.Field (0x80020009)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record."
Help!
Code (HTML truncated for readability)
<!-- #include file="../adovbs.inc" -->
<%
Dim iPageSize
Dim iPageCount
Dim iPageCurrent
Dim strSQL
Dim objPagingRS
Dim iRecordsShown
Dim I
Dim Recnum
Recnum = Request("Recnum")
iPageSize = 8
' Open DB and Set Password
Dim adoCon
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("../sterilization.mdb")
' Create the Recordset
Set objPagingRS = Server.CreateObject("ADODB.Recordset")
objPagingRS.PageSize = iPageSize
objPagingRS.CursorLocation = adUseClient
objPagingRS.CacheSize = iPageSize
' Select Records
strSQL = "SELECT * FROM PartShipForm WHERE Sterile_Lot_Number = '" & RecNum & "'"
objPagingRS.Open strSQL, adoCon
' Page number
If Request.QueryString("page") = "" Then
iPageCurrent = 1
Else
iPageCurrent = CInt(Request.QueryString("page"))
End If
' Page Count
iPageCount = objPagingRS.PageCount
' No records found
If iPageCount = 0 Then
Response.Write "No records found!"
Else
' Move to the selected page
objPagingRS.AbsolutePage = iPageCurrent
' Page Header
%>
<html>
<head>
<title>TX8391 Sterilization Tracking Log Database</title>
<link rel="stylesheet" href="../style.css" type="text/css">
</head>
<body>
<% ' Detail header %>
<table class="detail" width="760" border=1>
<tr>
<td width="100" align="center"><span class=btext>Quantity</span></td>
<td width="500" align="left"><span class=btext> Product Code/Description (to appear on certificate)</span></td>
<td width="160" align="center"><span class=btext>Lot Number</span></td>
</tr>
<%
' Detail Rows
iRecordsShown = 0
Do While iRecordsShown < iPageSize And Not objPagingRS.EOF
%>
<tr>
<td width="100" align="center"><span class=text> <% Response.Write objPagingRS("Quantity") %></span></td>
<td width="500" align="left"><span class=text> <% Response.Write objPagingRS("Product_Name") %></span></td>
<td width="160" align="center"><span class=text> <% Response.Write objPagingRS("Packaging_Lot_Number") %></span></td>
</tr>
<%
' Increment the number of records we've shown & move to next record
iRecordsShown = iRecordsShown + 1
objPagingRS.MoveNext
Loop
' Shipping Footer
%>
</table>
<table width="760">
<tr>
<td width="200" align="right" class="thick"><span class=text>TOTAL </span></td>
<td width="560" align="right" class="thick"><span class=text>Circle One: PRODUCTION / TEST </span></td>
</tr>
<tr>
<td colspan="2" align="left"><span class=size5>Any change from your standard dose parameter, box dimensions or density must be advised in writing and could require dose<br>
mapping. If a dose map is performed there may be a charge associated with this service.</span></td>
</tr>
</table>
<% ' Footer %>
<table width="760">
<tr>
<td align="left"><span class=text>F001888 Ver E.<br> Form, Production</span></td>
<td align="right" valign="top"><span class=text>Page <%= iPageCurrent %> of <%= iPageCount %><br>
<a href="../index.asp">Home</a>
<%
If iPageCurrent > 1 Then
%>
<a href="view_ship_gammatrbl.asp?page=<%= iPageCurrent - 1 %>&Recnum=<%= Recnum%>">[<< Prev]</a>
<%
End If
' Page numbers:
For I = 1 To iPageCount
If I = iPageCurrent Then
Response.Write ("")
Else
%>
<a href="view_ship_gammatrbl?page=<%= I %>&Recnum=<%= Recnum%>"><%= I %></a>
<%
End If
Next 'I
If iPageCurrent < iPageCount Then
%>
<a href="view_ship_gammatrbl?page=<%= iPageCurrent + 1 %>&Recnum=<%= Recnum%>">[Next >>]</a>
<%
End If
%>
</span></td>
</tr>
<tr>
<td colspan=2 align="center"><span class=text><i>This confidential document...</i></span></td>
</tr>
</table>
</body>
</html>
<% End If
' Close DB Objects
objPagingRS.Close
Set objPagingRS = Nothing
adoCon.Close
Set adoCon = Nothing
%>