Text box has no value but is not null?

ARW17

Board Regular
Joined
Oct 31, 2016
Messages
109
I have an equation on a subform to add up the number of vacation days scheduled. The equation is
=Sum([Duration by Day])

It works if the person has a vacation day scheduled, but if they don't I'm getting #Error.

I tried to fix it by writing =iif(isnull(Sum([Duration by Day]))=true, 0, Sum([Duration by Day]), but this still results in an error.

How can this text box have no value, but not be null?

Please help me fix this error:)
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Applying IsNull to the SUM is too late, because the SUM is an error at that point, not null. It is some of the individual items that might be Null.

Try this:
Code:
[COLOR=#333333]=Sum(Nz([Duration by Day],0))[/COLOR]
You use the Nz function to tell Access how to handle the Nulls. We are telling it to treat them as zeroes.
See here for help on the Nz function: https://www.techonthenet.com/access/functions/advanced/nz.php
 
Last edited:
Upvote 0
Applying IsNull to the SUM is too late, because the SUM is an error at that point, not null. It is some of the individual items that might be Null.
Oh, I get what you're saying, but I changed it to your suggestion and am still getting the #Error.
 
Upvote 0
Where exactly are you placing this formula on the SubForm?
In which section?

Can you post some small data samples of what is trying to be included in this SUM?
(I am curious as to the structure of your data and SubForm and how many records may be included in your SUM).
 
Upvote 0
Where exactly are you placing this formula on the SubForm?
In which section?
In the form footer.
Falvo, AmandaT3ARF01/30/17V1
Falvo, AmandaT3ARF02/05/17V0.5

<caption> VacDaySch </caption><thead>
[TH="bgcolor: #c0c0c0"] Employee [/TH]
[TH="bgcolor: #c0c0c0"] UserID [/TH]
[TH="bgcolor: #c0c0c0"] EventDate [/TH]
[TH="bgcolor: #c0c0c0"] EventTypeCode [/TH]
[TH="bgcolor: #c0c0c0"] Duration by Day [/TH]

</thead><tbody>
</tbody><tfoot></tfoot>
 
Last edited:
Upvote 0
So, is the issue when an employee has no records, or has a record where the Duration by Day field is Null, or both?
Is the Duration by Day a calculated field also?
If so, what is the formula that calculates it?
 
Upvote 0
If the employee has no vacation days scheduled, there will be no records.
The Duration by Day field is not calculate, it's just a number in a table.
 
Upvote 0
So, in post #5, you should a nice picture of a sample of the information in your Subform.
Can you post some examples of what this looks like when you get that error?
I am just trying to determine if the situation causing the error is when there are no records, or there is a record, but just nothing in that field?
 
Upvote 0
Yes, it will be blank:


<caption> PersDaySch </caption><thead>
[TH="bgcolor: #c0c0c0"] Employee [/TH]
[TH="bgcolor: #c0c0c0"] UserID [/TH]
[TH="bgcolor: #c0c0c0"] EventDate [/TH]
[TH="bgcolor: #c0c0c0"] EventTypeCode [/TH]
[TH="bgcolor: #c0c0c0"] Duration by Day [/TH]

</thead><tbody></tbody><tfoot></tfoot>
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top