Alright Visual Basic Gurus: Do your worst! Why Can't I Loop? (VB6)
This code makes sense to me, but when I run it, it says "Loop Without Do". Any suggestions on how to fix?
Dim FirstPaymentDate As Date
Dim CurrRowValue As Single
Dim NumStudentsInFlex2 As Single
NumStudentsInFlex2 = MSHFlexGrid2.Rows
CurrRowVal = 1
Do While CurrRowVal < NumStudentsInFlex2 'While counter is less than number of rows in all students grid
YesDate = 0
MSHFlexGrid2.Row = CurrRowVal
'MsgBox CurrRowVal & "(" & MSHFlexGrid2.Row & ")" & " / " & MSHFlexGrid2.Rows & " " & MSHFlexGrid2.TextMatrix(MSHFlexGrid2.Row, 0)
If MSHFlexGrid2.TextMatrix(CurrRowVal, 2) = Date Then
MSHFlexGrid1.AddItem (MSHFlexGrid2.TextMatrix(MSHFlexGrid2.Row, 0)) & vbTab & "First Bill"
CurrRowVal = CurrRowVal + 1
Loop
End If
If MSHFlexGrid2.TextMatrix(CurrRowVal, 3) = Date Then
MSHFlexGrid1.AddItem (MSHFlexGrid2.TextMatrix(MSHFlexGrid2.Row, 0)) & vbTab & "Last Bill"
CurrRowVal = CurrRowVal + 1
Loop
End If
FirstPaymentDate = MSHFlexGrid2.TextMatrix(MSHFlexGrid2.Row, 2)
YesDate = 0
If Format(Date, "MM/DD/YYYY") = Format(DateAdd("m", 1, FirstPaymentDate), "MM/DD/YYYY") Then YesDate = 1
If Format(Date, "MM/DD/YYYY") = Format(DateAdd("m", 2, FirstPaymentDate), "MM/DD/YYYY") Then YesDate = 1
If Format(Date, "MM/DD/YYYY") = Format(DateAdd("m", 3, FirstPaymentDate), "MM/DD/YYYY") Then YesDate = 1
If Format(Date, "MM/DD/YYYY") = Format(DateAdd("m", 4, FirstPaymentDate), "MM/DD/YYYY") Then YesDate = 1
If Format(Date, "MM/DD/YYYY") = Format(DateAdd("m", 5, FirstPaymentDate), "MM/DD/YYYY") Then YesDate = 1
If Format(Date, "MM/DD/YYYY") = Format(DateAdd("m", 6, FirstPaymentDate), "MM/DD/YYYY") Then YesDate = 1
If Format(Date, "MM/DD/YYYY") = Format(DateAdd("m", 7, FirstPaymentDate), "MM/DD/YYYY") Then YesDate = 1
If Format(Date, "MM/DD/YYYY") = Format(DateAdd("m", 8, FirstPaymentDate), "MM/DD/YYYY") Then YesDate = 1
If Format(Date, "MM/DD/YYYY") = Format(DateAdd("m", 9, FirstPaymentDate), "MM/DD/YYYY") Then YesDate = 1
If YesDate = 1 Then MSHFlexGrid1.AddItem (MSHFlexGrid2.TextMatrix(MSHFlexGrid2.Row, 0)) & vbTab & "Interval Bill"
CurrRowVal = CurrRowVal + 1
Loop
posted by fvox13 to computers & internet (9 comments total)
posted by null terminated at 6:34 PM on July 6, 2006