Others

Troubleshoot Microsoft Access Error 94: Invalid Use of Null

Khadija KhanKhadija Khan Nov 22, 2026 868 views

Question details

Identify why Microsoft Access VBA encounters a Null value when processing a new WBS record.

Troubleshoot Microsoft Access Error 94: Invalid Use of Null
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.
Before you start

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.

Solution 1Recommended

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.

1
Inspect the failing line

When Error 94 appears, click Debug and examine the highlighted VBA line. Note any DLookup calls, field references, and variables used on that line.

2
Check the current values

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.

3
Verify the lookup record

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.

4
Handle an expected 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.

Debug the VBA line and check the DLookup result
Check for duplicate matches: If multiple records match the WBS criteria, DLookup does not guarantee which matching value it returns. Review the query and enforce uniqueness where the data model requires it.
Free Microsoft Office alternative

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.

Review WBS lists and related tabular data in WPS SpreadsheetOpen and edit Microsoft Office formats such as DOCX, XLSX, and PPTXUse a familiar interface for everyday office tasksGet a free, lightweight office suite
QA img-9

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.