The basic concept behind this code is that whenever it runs, the quantity from an element decreases and the quantity from the same element, but from a different array, increases. For whatever reason, the second while loop only runs once and stops. For example, if total1 = 11 and total2 = 0, the first time the code is executed, total1 = 10 and total2 = 1. However after that, total1 = 9 and total2 = 1 and so on. Can anyone tell me what is wrong with my code? Any and all help would be appreciated.
<%
count = 0
do while NOT rs3.EOF
if rs3("ITEM_NO") = itemnum then
qtyArray(count) = qtyArray(count) - qtyreq
end if
if qtyArray(count) >= 0 and rs3("ITEM_NO") = itemnum then
total1 = total1 - qtyreq
end if
count = count + 1
rs3.MoveNext
loop
rs3.MoveFirst
pickcount = 0
do while NOT rs3.EOF
if qtyPick(pickcount) >= 0 and rs3("ITEM_NO") = itemnum then
qtyPick(pickcount) = qtyPick(pickcount) + qtyreq
total2 = total2 + qtyreq
end if
rs3.MoveNext
pickcount = pickcount + 1
loop
%>
Please make sure “qtyreq” variable is not 0 and really adds +1 to your total2.