kgcrowther
Registered User.
- Local time
- Today, 00:43
- Joined
- Jun 1, 2001
- Messages
- 52
I was using DLookup from a Query, but it was very slow (I assume Access must create the query each time I DLookup from it). Here is the original slow code that works fine, but slow:
d8p3 = DLookup("[D8P3]", "SPLIT-Destinations", "[SCTG_CODE] = " & sctg2)
I have three of these each time the do loop enters an if statement. It takes about 3 to 4 seconds to perform each one. (I estimate that it will enter the if statement about 14,000 times, and that's a lot of seconds!) I figure a solution is just to put the query in memory, something like:
Dim rsSplit As DAO.Recordset
Set rsSplit = CurrentDb.OpenRecordset("SPLIT-Destinations")
But then how do I write the DLookup?
d8p3 = DLookup("[D8P3]", "SPLIT-Destinations", "[SCTG_CODE] = " & sctg2)
I have three of these each time the do loop enters an if statement. It takes about 3 to 4 seconds to perform each one. (I estimate that it will enter the if statement about 14,000 times, and that's a lot of seconds!) I figure a solution is just to put the query in memory, something like:
Dim rsSplit As DAO.Recordset
Set rsSplit = CurrentDb.OpenRecordset("SPLIT-Destinations")
But then how do I write the DLookup?