How to iterate through results of SQL Query

  • Thread starter Thread starter David Wessell
  • Start date Start date
D

David Wessell

Hi,

Easy question here, but I'm not finding any examples..

If I've just placed a SQL query, how can I iterate through the results
using VBA?

rs.Open "SELECT * FROM generic table", _
dbMain, adOpenKeyset, adLockPessimistic
 
David,

try something like this:

While Not rs.EOF
'do something with the current record. i.e.
Debug.Print rs(0)
'move to the next one
rs.MoveNext
Wend
 
David,

try something like this:

While Not rs.EOF
'do something with the current record. i.e.
Debug.Print rs(0)
'move to the next one
rs.MoveNext
Wend

--
Hope that helps.

Vergel Adriano








- Show quoted text -

Hey Buddy,
THaks a lot. It helped me just now
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top