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.
dustingarrickAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
DLookups are great for grabbing a single value ONE time. If you need anything else, you're far better off building a query that returns your data, and then using THAT query when building other queries (like the one for your crosstab).
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
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.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.