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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

looping through recordsets

Status
Not open for further replies.

MBall2003

Programmer
May 30, 2003
61
US
Got a pretty easy one i think but i dont know how to do it. How can i open a recordset in code and loop through each record so i can test certain conditions for each record any help would be appreciated thanks
 
Hi!

This is the normal method:

Dim rst As DAO.Recordset

Set rst = CurrentDB.OpenRecordset("YourSet", dbOpenDynaset)

If rst.EOF = True And rst.BOF = True Then
Call MsgBox("There are no records")
Else
rst.MoveFirst
Do Until rst.EOF = True
Do your stuff here
rst.MoveNext
Loop
End If

Set rst = Nothing

hth


Jeff Bridgham
bridgham@purdue.edu
 
alrite thanks how do i get to a specific column in the recordset?
 
Hi!

After you have set a recordset you can access the fields using rst!YourField

hth


Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top