I am trying to run a nested loop; it should call a result from a MDB database. Which it does, when I run the single loop it goes thru all of the entries. But when I try to get a number to display twice it stops on the second entry. Having it display the number twice is just a test to make sure it does work, I am going to modify it after I can prove the loop works. The count on the Message Box is correct, but the number displayed is wrong?

I want it to display each number twice and then move on to the next number.


Please see the code below.




Nested Loop Code:
  1. Do Until number1 = 100
  2.             If number1 <= 0 Then Exit Do
  3.             number1 -= 1
  4.             counter1 += 1
  5.  
  6.             If intCurrentIndex < ds.Tables(0).Rows.Count - 1 Then
  7.                 intCurrentIndex = intCurrentIndex + 1
  8.  
  9.                 Do Until number2 = 10
  10.                     If number2 <= 0 Then Exit Do
  11.                     number2 -= 1
  12.                     counter2 += 1
  13.  
  14.                     txtResults.Text = ds.Tables(0).Rows(intCurrentIndex).Item("Results").ToString()
  15.                 Loop
  16.  
  17.             End If
  18.  
  19.         Loop
  20.  
  21.         MsgBox("The loop ran " & counter1 * counter2 & " times.")








Any Ideas

Thanks

Art W.