Posted By

CaptainProton on 07/06/11


Tagged

loop access recordset


Versions (?)

Loop through Recordset


 / Published in: Visual Basic
 

  1. Dim sql As String
  2. Dim rstRecordset As recordset
  3.  
  4. sql = "SELECT * FROM xxx;"
  5. Set rstRecordset = CurrentDb.OpenRecordset(sql, dbOpenSnapshot)
  6.  
  7. If rstRecordset.RecordCount > 0 Then
  8. rstRecordset.MoveFirst
  9.  
  10. Do While Not rstRecordset.EOF
  11. 'Access values with rstRecordset(0), rstRecordset(1), etc.
  12. rstRecordset.MoveNext
  13. Loop
  14. End If

Report this snippet  

You need to login to post a comment.