Others

Fix #Error in Microsoft Access Expiration Date Queries

Amos GikundaAmos Gikunda Nov 14, 2026 868 views

Question details

Replace #Error in calculated expiration date fields with either the effective date or a blank when an expiration period is empty.

Fix #Error in Microsoft Access Expiration Date Queries
Product
Microsoft Access
Device & OS
not provided
Scenario
An Access query uses DateAdd to calculate expiration dates from EffectiveDate and the ActiveEnforcement or PostDisclosure year value.
Observed behavior
The calculated field displays #Error when ActiveEnforcement or PostDisclosure is blank.
Before you start

Open the query in Design View and confirm that ActiveEnforcement and PostDisclosure are numeric year fields and EffectiveDate contains valid dates. Check that the field names match those used in your query.

Solution 1Recommended

Return the effective date when the year value is null

Use this approach when a missing expiration period should leave the effective date unchanged.

1
Open the query

In the Access Navigation Pane, right-click the query and select Design View.

2
Update the first calculation

In the Field row of the ActiveEnforcement expiration column, enter: ActiveEnforcementExpires: IIf(IsNull([ActiveEnforcement]),[EffectiveDate],DateAdd('yyyy',Nz([ActiveEnforcement],0),[EffectiveDate]))

3
Update the second calculation

In the Field row of the PostDisclosure expiration column, enter: PostEnforcementExpires: IIf(IsNull([PostDisclosure]),[EffectiveDate],DateAdd('yyyy',Nz([PostDisclosure],0),[EffectiveDate]))

4
Run and check the query

Select Run on the query design ribbon. Confirm that a null year value returns EffectiveDate and a populated value adds the specified number of years.

Return the effective date when the year value is null
Why Nz is included: Access evaluates both parts of IIf, so Nz supplies zero to DateAdd when the year field is null. The expressions assume EffectiveDate contains a valid date.
Free Microsoft Office alternative

Work with exported Access data in WPS Spreadsheets

WPS Office is a free, lightweight Office alternative with a familiar interface. Export Access query results to an Excel workbook to review and work with them in WPS Spreadsheets; WPS does not fix Access query expressions.

Review exported expiration dates in a familiar spreadsheet interfaceOpen and edit Microsoft Excel XLS and XLSX filesUse a free, lightweight suite for everyday document workMove existing Office documents into a familiar workspace
microsoft office alternative - wps office

Frequently Asked Questions

Why does a blank year field cause #Error in my Access query?

A blank numeric field may contain Null, which can cause a DateAdd calculation to fail. In Query Design View, use IsNull to choose a result and Nz to supply a safe numeric value to DateAdd.

How can I return the effective date instead of an error?

In the query's Field row, use IIf(IsNull([ActiveEnforcement]),[EffectiveDate],DateAdd('yyyy',Nz([ActiveEnforcement],0),[EffectiveDate])). This assumes EffectiveDate contains a valid date.

How do I display a blank instead of an expiration date?

In Design View, return Null in the IIf expression's true branch, for example: IIf(IsNull([ActiveEnforcement]),Null,DateAdd('yyyy',Nz([ActiveEnforcement],0),[EffectiveDate])).

What does 'yyyy' mean in DateAdd?

In DateAdd('yyyy', number, date), 'yyyy' specifies that the numeric value is added as years. For example, a value of 2 adds two years to EffectiveDate.

What should I check if the query still shows #Error?

In Query Design View, verify the field names and confirm that the year fields contain numeric values and EffectiveDate contains valid dates. IIf evaluates both branches, so an invalid DateAdd argument can still cause an error.