Some reason the WHILE condition will not loop while the 3 functions (highlighted) are there. If I comment out the functions like so (]<%'=sQtyPrior1(sItemNo)%>), the while loop will work.
When it is not commented it will display the information for the first record, then gives the following message.
I copied one of the functions below the main code, they are all similar with different SQL information.
Any ideas? Thanks!
----------[ ERROR MESSAGE ]--------
Microsoft VBScript runtime error '800a01a8'
Object required
/report_displayinventory_prt.asp, line 99
----------[ CODE ]--------
<%
sSQL = "SELECT imitno,imitd1,imitcl,imitsc FROM itmst WHERE imitcl='DS' AND imitsc<>'99'"
Set Rs = MyConn.Execute(sSQL)
While Not Rs.EOF
Counter = Counter + 1
sItemNo = Rs("imitno")
sItemDesc = Rs("imitd1")
If RowColor = "#FFFFFF" Then
RowColor = "#E5E5E5"
Else
RowColor = "#FFFFFF"
End If
%>
<tr>
<td align="right" bgcolor="<%=RowColor%>"><%=Counter%>.</td>
<td bgcolor="<%=RowColor%>"></td>
<td bgcolor="<%=RowColor%>"><%=sItemNo%></td>
<td bgcolor="<%=RowColor%>"></td>
<td bgcolor="<%=RowColor%>"><%=sItemDesc%></td>
<td bgcolor="<%=RowColor%>"></td>
<td align="right" bgcolor="<%=RowColor%>">[highlight]<%=sQtyPrior2(sItemNo)%>[/highlight]</td>
<td bgcolor="<%=RowColor%>"></td>
<td align="right" bgcolor="<%=RowColor%>">[highlight]<%=sQtyPrior1(sItemNo)%>[/highlight]</td>
<td bgcolor="<%=RowColor%>"></td>
<td align="right" bgcolor="<%=RowColor%>">[highlight]<%=sQtyYTD(sItemNo)%>[/highlight]</td>
</tr>
<%
[highlight]Rs.MoveNext[/highlight] <--- Line 99
Wend
Rs.Close
Set Rs = Nothing
%>
<%
Function sQtyYTD(sItemNo)
sSQL = "SELECT iaitno,iatrqt,iatrcd,iatrdt,imitno FROM iahst INNER JOIN itmst ON iahst.iaitno=itmst.imitno WHERE imitno='"&sItemNo&"' AND iawhid='CC' AND (iatrcd='Z' OR iatrcd='I') AND (iatrdt>'050101' AND iatrdt<'051231')"
Set Rs = MyConn.Execute(sSQL)
While Not Rs.EOF
sQtyYTD = sQtyYTD + cInt(Rs("iatrqt"))
Rs.MoveNext
Wend
Rs.Close
Set Rs = Nothing
End Function
%>
When it is not commented it will display the information for the first record, then gives the following message.
I copied one of the functions below the main code, they are all similar with different SQL information.
Any ideas? Thanks!
----------[ ERROR MESSAGE ]--------
Microsoft VBScript runtime error '800a01a8'
Object required
/report_displayinventory_prt.asp, line 99
----------[ CODE ]--------
<%
sSQL = "SELECT imitno,imitd1,imitcl,imitsc FROM itmst WHERE imitcl='DS' AND imitsc<>'99'"
Set Rs = MyConn.Execute(sSQL)
While Not Rs.EOF
Counter = Counter + 1
sItemNo = Rs("imitno")
sItemDesc = Rs("imitd1")
If RowColor = "#FFFFFF" Then
RowColor = "#E5E5E5"
Else
RowColor = "#FFFFFF"
End If
%>
<tr>
<td align="right" bgcolor="<%=RowColor%>"><%=Counter%>.</td>
<td bgcolor="<%=RowColor%>"></td>
<td bgcolor="<%=RowColor%>"><%=sItemNo%></td>
<td bgcolor="<%=RowColor%>"></td>
<td bgcolor="<%=RowColor%>"><%=sItemDesc%></td>
<td bgcolor="<%=RowColor%>"></td>
<td align="right" bgcolor="<%=RowColor%>">[highlight]<%=sQtyPrior2(sItemNo)%>[/highlight]</td>
<td bgcolor="<%=RowColor%>"></td>
<td align="right" bgcolor="<%=RowColor%>">[highlight]<%=sQtyPrior1(sItemNo)%>[/highlight]</td>
<td bgcolor="<%=RowColor%>"></td>
<td align="right" bgcolor="<%=RowColor%>">[highlight]<%=sQtyYTD(sItemNo)%>[/highlight]</td>
</tr>
<%
[highlight]Rs.MoveNext[/highlight] <--- Line 99
Wend
Rs.Close
Set Rs = Nothing
%>
<%
Function sQtyYTD(sItemNo)
sSQL = "SELECT iaitno,iatrqt,iatrcd,iatrdt,imitno FROM iahst INNER JOIN itmst ON iahst.iaitno=itmst.imitno WHERE imitno='"&sItemNo&"' AND iawhid='CC' AND (iatrcd='Z' OR iatrcd='I') AND (iatrdt>'050101' AND iatrdt<'051231')"
Set Rs = MyConn.Execute(sSQL)
While Not Rs.EOF
sQtyYTD = sQtyYTD + cInt(Rs("iatrqt"))
Rs.MoveNext
Wend
Rs.Close
Set Rs = Nothing
End Function
%>