Nested IIf and IsNull to resolve #Name? error (1 Viewer)

KFFACS

New member
Local time
Today, 14:16
Joined
Aug 22, 2018
Messages
2
I am looking for help in creating a formula having nested IIf statements whose conditions rely on two date fields. One or the other of the date fields may be Null.
The formula I have come up with so far is:

=IIf(IsNull([Text1]),([EnrolledDate])+21,DateAdd("d",365,[Text1]))

In addition
If [Text1] is null and [EnrolledDate] is null the result should be null

This is working as far as the calculations are concerned but the form will display #Name? if the [EnrolledDate] field is null. Not all of the clients will ever be enrolled.

I would like to clean up the end user form view so that “#Name?” does not appear.

Any help would be appreciated.
 
Last edited:

MarkK

bit cruncher
Local time
Today, 11:16
Joined
Mar 17, 2004
Messages
8,181
What should the outcome be if EnrolledDate is null? What should appear, if #Name? should not?
Mark
 

plog

Banishment Pending
Local time
Today, 13:16
Joined
May 11, 2011
Messages
11,645
Code:
=IIf(IsNull([Text1])=False,DateAdd("d",365,[Text1]), iif(isnull([EnrolledDate])=false, DateAdd("d",21,[EnrolledDate]))
 

KFFACS

New member
Local time
Today, 14:16
Joined
Aug 22, 2018
Messages
2
Plog - I used your formula along with one minor detail (the field was missing from my underlying query). The result was what I needed. Thanks for solving two of my issues as your response prompted me to look at this in a fresh way.
 

Users who are viewing this thread

Top Bottom