Replace Microsoft Access DLookup with a Faster Query Join
Question details
Improve query performance by replacing a DLookup expression with a SQL join.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- An Access query retrieves employee salary records and looks up a Paye value from another query.
- Observed behavior
- The query is slow when DLookup is evaluated for result rows.
Check the existing DLookup criteria and confirm which fields identify the correct salary record. Verify that the corresponding join fields have compatible data types and that the lookup query returns at most one intended match per record.
Replace DLookup with an Access SQL join
Use a join to retrieve the Paye value directly instead of evaluating DLookup for each result row.
In Access, right-click the query in the Navigation Pane and select Design View. Then choose View > SQL View.
Adapt the query to join the salary queries directly. For example: SELECT QryMonzeSalaries.EmployeeID, QryMonzeSalaries.NapsaFinal, QryMagoyeSalary.Paye AS PayeFin FROM QryMonzeSalaries INNER JOIN QryMagoyeSalary ON QryMagoyeSalary.ZZDone = QryMonzeSalaries.Mnths;
Compare the ON clause with the original DLookup criteria. If Paye is employee-specific and both queries expose EmployeeID, add an EmployeeID equality condition to the join so records are matched by employee as well as month.
Open the underlying tables in Design View and consider indexing the fields used in the join. Run the query with the Run button, then compare its results and execution time with the original.

Review exported salary data with WPS Spreadsheets
WPS Office is a free, lightweight alternative for working with exported salary data in a familiar spreadsheet interface. Its Microsoft Excel format compatibility makes it easy to move spreadsheet files between suites. It does not replace Access or fix Access query performance.

Frequently Asked Questions
Why can a join be faster than DLookup?
DLookup may be evaluated repeatedly for result rows. A join lets Access retrieve matching data as part of the query, although performance still depends on the data, indexes, and query design.
Should EmployeeID be included in the join?
Include EmployeeID when the Paye value is specific to an employee and the field is available in both queries. Match the join conditions to the original lookup criteria and the intended business rules.
How can I keep salary records that have no matching Paye value?
Use a LEFT JOIN with QryMonzeSalaries on the left. Unmatched salary rows remain in the result, with a null value for PayeFin.
Where should I add indexes if I am joining two queries?
Open the underlying tables in Design View and consider indexes on the fields used for matching, such as the month and employee fields. Queries themselves do not store indexes.
Why did the join return more rows than DLookup?
A join returns every matching row. Check the lookup query for duplicate matches and add the necessary join conditions or resolve duplicate source records.




