Troubleshoot Microsoft Access Error 94: Invalid Use of Null
Question details
Identify why Microsoft Access VBA encounters a Null value when processing a new WBS record.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- A VBA procedure uses DLookup and related fields to process new WBS information from a linked table.
- Observed behavior
- Error 94 occurs with new information while existing information continues to work. In this case, the new WBS value exceeded the field's 10-digit limit.
Identify the WBS value that triggers the error and have the relevant VBA procedure and qry_Current_POC query available. Check whether the WBS field is stored in a linked table, as its restriction may be defined in the source database.
Debug the VBA line and check the DLookup result
Use this method to find the expression receiving Null and determine whether the lookup has a matching record.
When Error 94 appears, click Debug and examine the highlighted VBA line. Note any DLookup calls, field references, and variables used on that line.
In the VBA editor, use Debug > Step Into or hover over variables to inspect the current WBS value and the DLookup result. Check the declaration of the variable receiving the result.
Open qry_Current_POC in Datasheet View and filter for the current WBS value. Confirm that a matching record exists and that GovernmentTaskLead is not Null.
In the VBA procedure, test the DLookup result with IsNull before assigning or using it. If a default is appropriate, use Nz with a fallback that matches the destination's data type; otherwise, handle the missing record explicitly.

Check the WBS field restriction and correct the value
Use this method when the error occurs only for a new WBS value or after linked-table information changes.
Work with Office documents in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with documents, spreadsheets, and presentations. Its Microsoft Office format compatibility helps make migration seamless. It does not fix Access Error 94 or replace Access database and VBA functionality.

Frequently Asked Questions
Why does DLookup return Null in Access?
DLookup returns Null if no record matches its criteria or if the returned field is Null. Open the source query, filter for the lookup value, and inspect the matching field.
How do I find the line causing Error 94?
Click Debug in the error dialog. Access opens the VBA editor and highlights the line where execution stopped; inspect its variables and lookup results.
Should I always use Nz to fix a Null value?
No. Use Nz only when a fallback value is meaningful and compatible with the receiving data type. Otherwise, use IsNull to detect the missing value and handle it explicitly.
Where can I check the WBS field's length restriction?
Open the source table in Design View, select the WBS field, and inspect its data type, Field Size, and validation rule. For a linked table, the restriction may be defined in the source database.
Can duplicate WBS records affect DLookup?
Yes. If more than one record matches the criteria, DLookup does not guarantee which matching value it returns. Check the query for duplicates and enforce uniqueness if the WBS value should identify one record.




