Looping through recordset with VBA

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 01:02:07

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!