Others

Fix Microsoft Access DLookup Field and Control Reference Errors

Phi Hung VoPhi Hung Vo Nov 22, 2026 868 views

Question details

Correct field names and form control references in Microsoft Access DLookup expressions.

Fix Microsoft Access DLookup Field and Control Reference Errors
Product
Microsoft Access
Device & OS
not provided
Scenario
A main form uses DLookup to retrieve information based on controls in a subform.
Observed behavior
Access reports that it cannot find a field when a DLookup expression contains an incorrectly quoted field name or an unqualified control reference.
Before you start

Open the form's VBA code or control expression and identify the DLookup calls that fail. Check the names of the lookup table or query, its fields, and the subform control on the main form.

Solution 1Recommended

Correct DLookup field names and subform references

Use this method when Access cannot find a field or a control used by a DLookup expression.

1
Quote the lookup field

In the VBA editor or expression containing DLookup, pass the field name as a string. For example, use DLookup("[btname]", "SO_Info_lookup", criteria), not DLookup([btname], "SO_Info_lookup", criteria).

2
Qualify subform controls

In code running on the main form, refer to a subform control through the subform control's name, such as Me![SubformControl].Form![SerialFrom] or Me![SubformControl].Form![SOrder]. Replace SubformControl with the actual control name on the main form.

3
Build the criteria safely

For a non-null text value from SOrder, build criteria such as "[SOrder] = '" & Replace(CStr(Me![SubformControl].Form![SOrder].Value), "'", "''") & "'". This doubles any apostrophes in the value. Use the actual lookup field name and a numeric criterion without text quotes if the field is numeric.

4
Review and test each expression

In the VBA editor or form property sheet, check every DLookup call for quoted field and domain names, brackets around names with special characters, and valid criteria. Run the form again and test the affected controls.

Correct DLookup field names and subform references
Check the subform control name: The subform control's name on the main form can differ from the name of the form displayed inside it. Select the subform control in Design View and check its Name property.
Free Microsoft Office alternative

Work with spreadsheet lookup data in WPS Office

WPS Office is a free, lightweight alternative for spreadsheet and document work, with a familiar interface and support for common Microsoft Office formats. Open compatible files to move spreadsheet work into WPS; it does not run Access databases or fix Access DLookup code.

Use spreadsheet lookup functions to find values in tabular dataOpen and edit Microsoft Excel XLS and XLSX filesWork in a familiar, easy-to-use interfaceMove compatible spreadsheet files into a lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why does DLookup need quotation marks around the field name?

DLookup expects its expression and domain arguments as strings. In VBA, use DLookup("[btname]", "SO_Info_lookup", criteria) so Access receives the field name rather than evaluating [btname] as a reference first.

How do I reference a control on a subform from the main form?

In main-form VBA, use Me![SubformControl].Form![ControlName], replacing both names with the actual subform control and target control names. Check the subform control's Name property in Design View.

How can I use a text value containing an apostrophe in DLookup criteria?

Double apostrophes in the value before inserting it into a text criterion. In VBA, use Replace(value, "'", "''") and surround the resulting value with single quotes in the criteria string.

Can WPS Office run my Access DLookup expressions?

No. Access DLookup expressions and forms must be corrected in Microsoft Access. WPS Spreadsheets can work with compatible spreadsheet files and spreadsheet lookup functions instead.