Solved

access replace DLookup with SQL

Posted on 2010-08-16
5
571 Views
Last Modified: 2012-05-10
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 & "#")  
.....etc.

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

Any suggestions?

Thanks for your help.
0
Comment
Question by:johnmadigan
5 Comments
 
LVL 58

Expert Comment

by:cyberkiwi
ID: 33445465
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] ?
0
 
LVL 18

Expert Comment

by:p912s
ID: 33447939
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?




0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 33449567
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...

JeffCoachman
0
 
LVL 26

Expert Comment

by:jerryb30
ID: 33471810
Making a temp table from the results of qryFrCapCalOpen might speed things up, especially if the query is itself complex.  
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 34469397
Thanks, but please review jerryb30's suggestion.
What he posted is about the only way to increase the "Perceived" speed of a query...

JeffCoachman
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Programmer 14 49
SQL Group on First occurrence 9 25
Setting Macro in Access to Automate Running an Append at a Certain Time 2 22
aggregate query? 20 50
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question