Value lookup by record number

  • Thread starter Thread starter Elwin
  • Start date Start date
E

Elwin

You're trying to retrieve a value based upon the record's
position in a recordset. I suggest using the form's
RecordsetClone object.

Dim var as Variant
Dim rst as DAO.Recordset
Set rst = Me.RecordsetClone
With rst
Do Until .EOF
If .AbsolutePosition = 5 Then
var = !MyField
Exit Do
End If
Loop
End With
rst.Close
Set rst = Nothing
 
Ah- That's it!
Thanks a lot everyone! it works perfectly.
You have no idea how slow it was going through every
single of the 1400 records and running DLookup on each
one (10 times), checking to see if it matched the
selected criteria, and then writing it to an array if it
did.
This is waaaaaaaayyyyyyyy faster.

Andy
 
Back
Top