croy said:
So I've got this form... with some controls that use
DLookup as the Control Source.
How do I switch that to "straight SQL"?
You really do not need to.
The domain functions DCount(), DLookup(), etc., incur some processing
overhead each time they are used. This overhead is completely unrelated to
how efficiently they retrieve their data which is every bit as efficient as
using any other method (like "straight SQL").
The problem is when you use them in a query or in a looping operation
because that processing overhead is incurred for every single row of the
query and every single iteration of the loop. THAT is when domain functions
suck and when their use is not recommended.
Using them a handful of times on a form is not going to incur that much of a
penalty and replacing them with something else will make very little
difference. In fact most replacements will not make any difference at all
if you do not take care to not invoke the same overhead that the domain
functions do.
Now, if you're talking about a continuous or datasheet form then as stated
above you should try to avoid them. In those cases one would normally try
to get the base query of the form to use a sub-query or other "straight SQL"
solution.
If you're talking about a standard one-record-at-a-time form then don't
bother to change anything.