DJ said:
I was debating the use of 2 DLookup functions (Embedded probably)
versus a Recordset query to retrieve information from a database with
two tables. Speed is my main concern. Can anyone please tell me the
pros and cons to the use of each?
Given that DLookup opens a recordset "under the covers", there's not a
whole lot to choose between a single DLookup and opening your own
recordset to find one value. But if you can replace two DLookups with a
single OpenRecordset (by specifying a suitable SQL statement for the
recordset), then the recordset will naturally be faster. If you're
concerned with extremely minor performance differences, then the
recordset approach would probably be a teensy bit faster even for
looking up a single value, but it's probably not worth it unless you're
doing it in a tight loop. And if you're performing the operation over
and over again in a loop, then by setting your database reference
outside the loop and using OpenRecordset inside it, you'll probably get
much better performance than DLookup.