Why Does Microsoft Access DLookup Return Null and How to Fix It
Question details
Users experience a Null return value when executing the DLookup function in Microsoft Access, even when the data appears to exist in the targeted table or field.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Querying specific records using the DLookup function on text or hyperlink fields within a database.
- Observed behavior
- The DLookup function returns a Null value instead of the expected field data, typically because the exact criteria match fails due to hidden string formatting or hyperlink structures.
Verify that the table name, field name, and variable values used in your DLookup expression are spelled correctly and that the record actually exists in your database.
Use the LIKE Operator with Wildcards
Replace the exact equals comparison with a LIKE operator to handle hidden characters, which is particularly effective for hyperlink fields.
When querying text or hyperlink fields, Microsoft Access might fail to find an exact match due to hidden formatting, embedded URLs, or trailing spaces. Using the LIKE operator along with asterisk (*) wildcards allows for partial matching, ensuring the function retrieves the intended record.
In Microsoft Access, press Ctrl+G to open the Immediate Window within the VBA editor.
Test your DLookup expression using a wildcard search by typing: Debug.Print DLookup("[Name]", "Documents1", "[Name] Like '*" & strProject & "*'")
If you know the target value strictly begins with your variable, adjust the syntax to only use a wildcard at the end: DLookup("[Name]", "Documents1", "[Name] Like '" & strProject & "*'")
Replace your original exact match DLookup code with the successful LIKE condition in your VBA script or query.

Looking for a Lightweight and Free Office Suite? Try WPS Office
While Microsoft Access handles complex databases, most of your daily document, spreadsheet, and presentation tasks can be done faster and for free. WPS Office offers a seamless Microsoft Office alternative with full compatibility for Word, Excel, and PowerPoint files without the heavy subscription fees.
- 1. Download the Installer: Visit the official WPS Office website and click the free download button for your operating system.
- 2. Install WPS Office: Run the downloaded installer and follow the quick on-screen setup instructions.
- 3. Open Your Files Seamlessly: Launch WPS Office to instantly open, edit, and save your existing Microsoft Office documents.

Frequently Asked Questions
Why does DLookup return Null even when I can see the record exists?
DLookup returns Null when the criteria expression doesn't perfectly match the stored value. This often happens with data types like hyperlinks, fields containing trailing spaces, or when text variables are missing single quotation marks in the criteria string.
How do I test my DLookup function without running the entire macro?
You can test your DLookup function directly in the VBA Immediate Window. Press Ctrl+G to open it, type 'Debug.Print' followed by your DLookup expression, and press Enter to see the immediate result.
Can I use DLookup for multiple criteria at once?
Yes, you can combine multiple criteria using the AND or OR operators within the criteria string. For example: "[Field1] = 'Value1' AND [Field2] = 'Value2'". Ensure you handle text, date, and number delimiters properly for each field.




