- Local time
- Today, 12:44
- Joined
- Feb 19, 2002
- Messages
- 45,726
Once you know what the best, most efficient option is, use it. Train yourself to be the best that you can be rather than mediocre. That way, when it matters, you won't have to look back and find a conversation like this to remind you of better options. Your apps won't be filled with mediocre solutions that usually work, they'll be filled with solutions worth copying.Dmax is easier to use. I am working with a miniscule amount of data, so performance is not really an issue.
Sometimes the domain function is the best option but almost never in a query or in a VBA loop. As a stand-alone, one-off get a piece of data, domain functions are the best, simplest solution. The solution in #8 seems to be the best option based on your original question. The domain function is simpler than opening a query. Since both the original code and the domain function each run a single query with no where clause, each will generate the same execution plan. If the datetime field is indexed, Access will use an index to obtain the value. Otherwise, it will read RBAR (row by agonizing row) through every single row in the table because it can't determine the max value until it has read all values.