Looping Through Recordset With Vba
I am trying to assign salespeople (rsSalespeople) to customers (rsCustomers) in a round-robin fashion in the following manner: Navigate to first Customer, assign the first SalesPe
Solution 1:
rsSalespeople.EOF doesn't indicate when you are on the last row, it indicates when you are PAST the last row.
So when your conditional hits the last salesperson EOF is false so it does a movenext (making EOF true) then the next pass through the loop is operating on the "EOF row" of rsSalespeople which you can't pull values from, hence the error.
Try this instead:
rsSalespeople.MoveNext
If(rsSalespeople.EOF) Then
rsSalespeople.MoveFirst
End If
Post a Comment for "Looping Through Recordset With Vba"