lundi 13 avril 2015

Seemingly infinite loop


Vote count:

0




This loop is supposed to be looping through lines and when it reaches the end it should exit the loop. It seems to get stuck and not exit. I used an almost identical loop in a different macro so why doesn't this one work here?


If not rs2.eof Then rs2.movefirst Do until rs2.eof



Set ORDERLINE = ORDERLINES(CInt(rs2("ROW"))-1).VALUE

If ORDERLINE("udfStringCol8") = trim(group) Then
For i = 0 to (Lcnt - 1)
Set ORDERLINE = ORDERLINES(i).VALUE
objExcel.Cells(i+2, 1).Value = ORDERLINE("PART_ID")
objExcel.Cells(i+2, 2).Value = ORDERLINE("DESCRIPTION")
objExcel.Cells(i+2, 3).Value = ORDERLINE("USER_3")
objExcel.Cells(i+2, 4).Value = ORDERLINE("USER_6")
objExcel.Cells(i+2, 5).Value = ORDERLINE("USER_8")
objExcel.Cells(i+2, 6).Value = ORDERLINE("USER_7")
rs2.movenext
Next
End If
loop
End If
rs2.close


asked 1 min ago







Seemingly infinite loop

Aucun commentaire:

Enregistrer un commentaire