Return Zero not Null

  • Thread starter Thread starter chopper57 via AccessMonster.com
  • Start date Start date
C

chopper57 via AccessMonster.com

How would I place the Nz function is the following:

Sum(IIf([Finish]>[Start],([Finish]-[Start])*24,24-([Start]-[Finish])*24)-
[Breaks])

the fomula works, but I need to show reports that have no hours also.
I've been inserting the Nz, with no results so far.
 
If you put Nz() around each field name, then any field that is Null would be
changed to zero for the calculation. So, if you had a value in Start but not
one in Finish, you would get (Start-0*24).

Example:
Sum(IIf(Nz([Finish],0)>Nz([Start],0),(Nz([Finish],0)-Nz([Start],0))*24,24-(Nz([Start],0)-Nz([Finish],0))*24)-Nz([Breaks],0))


If all you want is to get a zero out if any of the fields is Null, then you
could get by with placing Nz() around the IIf().

Example:
Sum(Nz(IIf([Finish]>[Start],([Finish]-[Start])*24,24-([Start]-[Finish])*24)-[Breaks],
0))
 
Thanks Wayne, that got it!

Wayne said:
If you put Nz() around each field name, then any field that is Null would be
changed to zero for the calculation. So, if you had a value in Start but not
one in Finish, you would get (Start-0*24).

Example:
Sum(IIf(Nz([Finish],0)>Nz([Start],0),(Nz([Finish],0)-Nz([Start],0))*24,24-(Nz([Start],0)-Nz([Finish],0))*24)-Nz([Breaks],0))

If all you want is to get a zero out if any of the fields is Null, then you
could get by with placing Nz() around the IIf().

Example:
Sum(Nz(IIf([Finish]>[Start],([Finish]-[Start])*24,24-([Start]-[Finish])*24)-[Breaks],
0))
How would I place the Nz function is the following:
[quoted text clipped - 3 lines]
the fomula works, but I need to show reports that have no hours also.
I've been inserting the Nz, with no results so far.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top