- Local time
- Today, 10:45
- Joined
- Feb 28, 2001
- Messages
- 30,010
Actually, it should not be faster UNLESS you had a DLOOKUP in the query, because VBA is interpreted but the query processor is compiled.
If you have a slot already in the extant table for that difference, then you don't need an extra table. Then you just do your recordset ops to include a .Edit and a .Update (doing, in essence, an update in place).
If you will note, I did ask how many records were involved. My VBA answer is purely theoretical based on general principles. However, I have never claimed to be so much of a purist as to avoid the quick-but-dirty methods now and then.
The only issue I have with this kind of problem is that the syntax of the WHERE clause is usually SO convoluted as to be worse than writing the code. And please note also in the thread that our OP has indicated that the dates are non-uniformly spaced including cases that could occur on the same day. The SQL syntax for THAT one becomes a nightmare, but doing it via VBA can NEVER get confused. (If the recordset's base query is written incorrectly, the answer can be WRONG - but never confused.)
If you have a slot already in the extant table for that difference, then you don't need an extra table. Then you just do your recordset ops to include a .Edit and a .Update (doing, in essence, an update in place).
When the number of records is low enough that the query execution time isn't a problem why not use a query?
If you will note, I did ask how many records were involved. My VBA answer is purely theoretical based on general principles. However, I have never claimed to be so much of a purist as to avoid the quick-but-dirty methods now and then.
The only issue I have with this kind of problem is that the syntax of the WHERE clause is usually SO convoluted as to be worse than writing the code. And please note also in the thread that our OP has indicated that the dates are non-uniformly spaced including cases that could occur on the same day. The SQL syntax for THAT one becomes a nightmare, but doing it via VBA can NEVER get confused. (If the recordset's base query is written incorrectly, the answer can be WRONG - but never confused.)