Solved Form calculation IIF? (1 Viewer)

GC1

New member
Local time
Today, 00:45
Joined
Apr 6, 2020
Messages
17
Good Day,

I have a form which has a calculation however I only want the calculation to calculate when another text box has a value. At present when the form is loaded the calculation completes without there being a value.

The calculated field (RemainingLife) is based on this
Code:
([installdate]+[indicative date]) – [CurrentYear]

Installdate is manually entered however when this is blank the calculation completes which is messy. I would like this calculation (RemainingLife) to only complete when install date has a value.

I have tried a combination of iff statements with IsNull, IsEmpty but I just can’t seem figure this one out.

Code:
=IIf(IsEmpty([txtInstallDate]),"",([txtInstallDate]+[txtIndicativeLife])-[txtCurrentYear])
Code:
=IIf(IsNull([txtInstallDate]),"",([txtInstallDate]+[txtIndicativeLife])-[txtCurrentYear])

Any assistance would be greatly appreciated.

Thanks
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:45
Joined
Oct 29, 2018
Messages
21,454
Looks to me like the second one should work. If the textbox is not null but empty, you might try checking for both. For example:
Code:
=IIf([txtInstallDate] & ""="","",YourFormulaHere)
 
  • Like
Reactions: GC1

GC1

New member
Local time
Today, 00:45
Joined
Apr 6, 2020
Messages
17
Looks to me like the second one should work. If the textbox is not null but empty, you might try checking for both. For example:
Code:
=IIf([txtInstallDate] & ""="","",YourFormulaHere)
Thank you theDBguy, your code has worked, much appreciated :)
 

Users who are viewing this thread

Top Bottom