Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

For Each...Next Help

Status
Not open for further replies.

spizotfl

MIS
Aug 17, 2005
345
US
I was wondering if there is a way from within a For Each...Next loop to Resume the loop.... What I mean is I am in the loop and am testing for a condition, but the only way I can really get the conditional test right leaves me with no way to resume the loop.
Ok, here is sorta whats happening:
Code:
If rs.bof and rs.eof Then
    'want to resume loop here
Else
    rs.movefirst
End if
so, what i really need is a way to check if i have an empty recordset, but if it isn't, i need to go to the first record, and the only action if the recordset is empty is to just continue the loop. i just figured there was a way to resume a loop, but i can find nothing in the vba help, the msdn site, a few pages of google results, and a search of this forum.
thanks for any help.

"Maturity is a bitter disappointment for which no remedy exists, unless laughter can be said to remedy anything."
-Vonnegut
 
Simply..


For each tbl in db.TableDefs
If Not rs.bof and Not rs.eof Then
rs.movefirst
End if
Next tbl
 
thank you, i think my whole setup was flawed. i reconsidered what i did and managed to get the results that i was looking for consistently. thanks for the wisdom, though. funny how the obvious can elude you so...

"Maturity is a bitter disappointment for which no remedy exists, unless laughter can be said to remedy anything."
-Vonnegut
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top