how to do a loop through a table

  • Thread starter Thread starter Daniel M
  • Start date Start date
D

Daniel M

I have a temporary linked table that i scan data into. I need to process a
query on each line of the table. can someone give me some idea as to how i
can do this?

I may have for instance 5 lines in the table (1 column only!) and i need to
do a lookup of that value in another table. I have to lookup part down but i
need to know how to lookup from a table then repeat it with the next row.

thanks.
 
Daniel M said:
I have a temporary linked table that i scan data into. I need to process a
query on each line of the table. can someone give me some idea as to how i
can do this?

I may have for instance 5 lines in the table (1 column only!) and i need
to
do a lookup of that value in another table. I have to lookup part down but
i
need to know how to lookup from a table then repeat it with the next row.


It sounds like you need to loop through a recordset, along these lines:

Dim rs As DAO.Recordset
Dim varFieldValue As Variant

Set rs = CurrentDb.OpenRecordset("YourTableOrQueryName")

With rs
Do Until .EOF
varFieldValue = !YourFieldName

' ... Do something with varFieldValue here ...

.MoveNext
Loop
.Close
End With

Set rs = Nothing
 
Back
Top