Looping through every record

Lanason

Registered User.
Local time
Today, 12:45
Joined
Sep 12, 2003
Messages
258
Does anyone know the syntax for a loop that steps through every record in a table

For 1 to x (where x in the no of records in the table)

action

next


how do I set X to be the number of records in the table???
 
Do you really need to do so? What do you need to loop for?

Anyway, here it is:

Code:
Dim db As DAO.Database
Dim rst As DAO.Recordset

Set db = CurrentDb
Set rst = db.OpenRecordset("TableOrQueryNameHere")

Do Until rst.EOF
   '...do something
   rst.MoveNext
Loop

rst.Close
Set rst = Nothing
 

Users who are viewing this thread

Back
Top Bottom