Looping

A

Allison

Can you provide a reference book or guide using DAO code
for looping through a recordset and determining if there
are any errors.
 
T

Tim Ferguson

Can you provide a reference book or guide using DAO code
for looping through a recordset and determining if there
are any errors.

strSQL = "SELECT IDNum FROM MyTable " & _
"WHERE SomethingWrong = TRUE " & _
"ORDER BY IDNum;"

Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot, dbForwardOnly)

If rs.EOF Then
MsgBox "There are no errors"

Else
Debug.Print "These are the problem records:"
Do While Not rs.EOF
Debug.Print rs!IDNum
rs.MoveNext

Loop

End If


rs.Close


Hope that helps


Tim F
 

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

Top