access replace DLookup with SQL

I have a calendar that puts total capacity numbers each day.  I use DLookups to calculate the capacity for each day - it is very slow.  I would like to use a sql query in hopes of speeding it up.  I currently have:

Cap2 = DLookup("[Qty]", "qryFrCapCalOpen", "[CompDate] = #" & Me.txtDay2 & "#")
Cap3 = DLookup("[Qty]", "qryFrCapCalOpen", "[CompDate] = #" & Me.txtDay3 & "#")
Cap4 = DLookup("[Qty]", "qryFrCapCalOpen", "[CompDate] = #" & Me.txtDay4 & "#")  

I am not sure how to proceed with the VBA code.

Any suggestions?

Thanks for your help.
Who is Participating?
Jeffrey CoachmanConnect With a Mentor MIS LiasonCommented:
You could use a query, but then you would need a way to pass the query result to the form.
The added code to do this (Using a Recordset would be one way) would probably eat up more resources.

Speed is relative.
If your dlookup is searching a huge table, then this may never be "Fast", no matter what the technology...

Changing to query form still requires the query to go through and collect the data for each of the days being shown.
Do you have an index on table qryFrCapCalOpen column [CompDate] ?
I'm guessing you're already using a query because the table name in your expression is qryFrCapCalOpen. Do the tables that qryFrCapCalOpen is pulling from have indexes?

Making a temp table from the results of qryFrCapCalOpen might speed things up, especially if the query is itself complex.  
Jeffrey CoachmanMIS LiasonCommented:
Thanks, but please review jerryb30's suggestion.
What he posted is about the only way to increase the "Perceived" speed of a query...

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.