Looping

  • Thread starter Thread starter Srenfro
  • Start date Start date
S

Srenfro

Is there a way to loop only a few colomns in a table if it only has one
record in it and if it is i have 36 colomns i want to do this to. Is there a
way??

thanks

stephen
 
Is there a way to loop only a few colomns in a table if it only has one
record in it and if it is i have 36 colomns i want to do this to. Is there a
way??

thanks

stephen

It's possible, but you should never need to do this in a properly constructed
table.

What you would do is open a Recordset based on the table and loop through its
Fields collection.


John W. Vinson [MVP]
 
Can you explain to me how to do this

What you would do is open a Recordset based on the table and loop through its
Fields collection.

Thank you
 
Can you explain to me how to do this

What you would do is open a Recordset based on the table and loop through its
Fields collection.

Dim rs As DAO.Recordset
Dim db As DAO.Database
Dim i As Integer
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM tablename", dbOpenDynaset)
For i = 0 To rs.Fields.Count - 1
Debug.Print i, rs.Fields(i).Name, rs.Fields(i).Value
Next i


John W. Vinson [MVP]
 
Back
Top