rc*****@comcast.net wrote:
I have a table with no ID field. I would like to read a single field
of each record using DLookup or something similar and pass it to a VB
function that's already been written. However, DLookup doesn't seem
to be able to "index" a table, but rather returns a field based on
some matching criteria.
What's the simplest way to iterate a table like I need to do in VB?
My VB skills are mediocre and my SQL skills are even worse, so if it's
doable in VB, that might be the best way for me. I don't care how
long the operation takes.
Thanks,
Rich
What is the function going to do? Are you sure it can't be done with a query?
Iterating through a table is seldom necessary, but to do so you would create a
RecordSet and loop through it in code.
Dim db As Database
Dim rs As Recordset
Set db = CurrentDB
Set rs = db.OpenRecordset("TableName")
Do Until rs.EOF
YourFunction(rs!FieldName)
rs.MoveNext
Loop
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com