An article in Access Advisor magazine (years ago) discussed
testing and comparison of all of the lookup methods and DLookup()
(when used with an index) came in second place losing out only to
Seek. It found only a negligible difference between DLookup() and
a Recordset with the Recordset actually being the slower of the
two.
Until Access 2000, I belive, all the domain aggregate functions were
slow on linked tables. That was why Trevor Best wrote his wonderful
t-functions to replace the built-in domain aggregate functions
(tCount(), tLookup(), etc.). After Access fixed the problem with
linked tables being slow (it may have been a service pack of A97
that fixed it, now that I think back on it), there was no longer any
need for it, but I'd become addicted to my own alterations of
Trevor's functions (where I used an optional argument supplying a
database variable so I could run them on something other than
CurrentDB()).
Seek, of course, is useless for lookups on more than one table.
And I just don't see it as useful in much of any circumstances.
Recordset.FindFirst can be optimized if your recordset is ordered by
the field being searched on. I did a whole bunch of testing on this
a couple of years ago and found that FindFirst is faster with an
index, but seems to do something of a table scan, as the time to
find a value is linearly proportional to the distance from the top
of the table. Because of that, you can optimize the FindFirst by
checking where you are in the recordset and doing a FindPrevious or
FindNext based on whether the next-sought value is greater than or
less than the current value.
To illustrate, say you have a table with FK DonorID, and you open a
recordset on that table, with a primary sort by DonorID and a
secondary sort by some other value. If you FindFirst
"[DonorID]=500000" you'd start from the top. For you next FindFirst,
if you're looking for 100000, then do a FindPrevious, and if you're
looking for 800000 do a FindNext. This improved performance by a
noticeable amount.
My recent work has reminded me of that testing, because I'm upsizing
the app that I did that testing for, and a stored procedure makes it
possible for me to abandon the persistent recordset that I was using
for lookups, so all that code that I wrote to implement the process
described above has been ripped out in the last two weeks!
But it was a valuable lesson that perhaps others might benefit from
hearing about.