Link to home
Start Free TrialLog in
Avatar of dustingarrick
dustingarrick

asked on

Dlookup efficiency in MS Access

I am trying to use a select query to analyze annual data records from crosstab query of values grouped at the intersection of column (field number) and row (year).  

The Dlookup syntax follows:  

1-from query design view:
606: DLookUp("[606]","CrosstabPHXAMA","Year = " & [year])

OR
2-in SQL view

DLookUp("[606]","CrosstabPHXAMA","Year = " & [year]) AS 606

The goal is to order it by year to combine with other data fields summed by year.  I am having difficulty getting the operation to run efficiently.

Thanks for any tips on simplifying this to avoid bogging down.  **When I run the query, it freezes when reaching the field generated by this syntax.
ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
To add to what LSM said, *never* use a domain function in a query.  It's equivalent to using a subselect (which you could write directly in the SQL statement), but it is totally un-optimizable by the query parser.    If you use a Dlookup(), DCount(), etc in a query, your destined for poor performance from the start.
No points here please.
JimD.