I want to programatically loop through all the rows in my database when a user clicks on a pushbutton.

However I get an error:
"Object variable or with block variable not set"

Here's what I am doing:

do while not adoTargets.recordset.eof
...
... processing code here
...
loop

What am I doing wrong ? I want it to loop until EOF.