Calculations with empty fields

  • Thread starter Thread starter Learning as I go
  • Start date Start date
L

Learning as I go

I have a report that is calculating total elapsed time between dates. I have
the calculation working fine if all fields are filled in. However, out of
necessity there will always be fields that are not filled in yet (because the
orders have not yet arrived, shipped, etc.). I am (of course) getting the
#error result for all of these cases. I would like for these fields to
remain blank until the orders have arrived, shipped, etc.

I am pretty sure that I need to use .hasdata, but can not quite get it to
work. My expression for the calculated fields is below.

=Workdays([FirstDate],[SecondDate])

I would greatly appreciate any help you can give.
 
HasData is used to determine if a report or subreport has data.

For individual fields you need to test if the field is null or not.

=IIF(IsNull([FirstDate]) or IsNull([SecondDate]), Null,
Workdays([FirstDate],[SecondDate]))

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
Thank you so much. I was obviously looking at it all wrong Friday.
--
Thank you for your time and assistance!

Elizabeth


John Spencer said:
HasData is used to determine if a report or subreport has data.

For individual fields you need to test if the field is null or not.

=IIF(IsNull([FirstDate]) or IsNull([SecondDate]), Null,
Workdays([FirstDate],[SecondDate]))

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
I have a report that is calculating total elapsed time between dates. I have
the calculation working fine if all fields are filled in. However, out of
necessity there will always be fields that are not filled in yet (because the
orders have not yet arrived, shipped, etc.). I am (of course) getting the
#error result for all of these cases. I would like for these fields to
remain blank until the orders have arrived, shipped, etc.

I am pretty sure that I need to use .hasdata, but can not quite get it to
work. My expression for the calculated fields is below.

=Workdays([FirstDate],[SecondDate])

I would greatly appreciate any help you can give.
.
 
Back
Top