How to use If() in Report

  • Thread starter Thread starter sg
  • Start date Start date
S

sg

Hi,

In Report design view, detail section, I like to come up % with the
following two fields
field1: $Last Year
field2: $This Year

$This Year/$Last Year

If $Last Year is 0 or null, I want it to be nothing, otherwise $ this
year/$Last Year.

How can I do this?
Any idea would be greatly appreciated.

Sarah
 
Hi,

In Report design view, detail section, I like to come up % with the
following two fields
field1: $Last Year
field2: $This Year

$This Year/$Last Year

If $Last Year is 0 or null, I want it to be nothing, otherwise $ this
year/$Last Year.

How can I do this?
Any idea would be greatly appreciated.

Sarah

In an unbound control:
=IIf(IsNull([$LastYear]) or [LastYear]=0,0,[$ThisYear]/[$LastYear])
 
Hi sg,
I thought this is Form Coding not Reports. :)
The idea is the same. In Text Box field that calculate "$This Year/$Last
Year". In the control source "=iif(nz([$Last Year]) = 0, Null, [$This
Year]/[$Last Year])

Hope this helps.
 
Thanks Fred and JL, this is just what I need and it works. I will do the
same in one of my form too.

Thanks again,
Sarah
 
Back
Top