View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Vergel Adriano Vergel Adriano is offline
external usenet poster
 
Posts: 857
Default How to iterate through results of SQL Query

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


"David Wessell" wrote:

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

---

THanks
David