Using If/When type expressions in a report

  • Thread starter Thread starter Linda Wampach
  • Start date Start date
L

Linda Wampach

I want to create a field within a report based upon
whether another field is true or false. Not only that,
but I want to be able to calculate that field. For
instance:

Typically, the TOTALUNITS field would be calculated by
using a =Sum[Units]expression. I want to be able to
multiply the TOTALUNITS by .7 if another field (yes/no
field) called MANAGER is = yes. Otherwise, I want to just
sum the field.

I need to do this in the report.

Any ideas?
 
Use an unbound text box
Set the control source to
=IIF([manager]=-1,[TOTALUNITS]*.7,SUM([UNITS]))

Make sure you use the names for your fields that appear on
the Name line of your text boxes, otherwise you will get
error messages.
For some reason Access uses -1 to mean yes and 0 to mean No
Hope this helps
 
= Sum(IIF(Manager = -1, .7,1)*[Units])
Use an unbound text box
Set the control source to
=IIF([manager]=-1,[TOTALUNITS]*.7,SUM([UNITS]))

Make sure you use the names for your fields that appear on
the Name line of your text boxes, otherwise you will get
error messages.
For some reason Access uses -1 to mean yes and 0 to mean No
Hope this helps
-----Original Message-----
I want to create a field within a report based upon
whether another field is true or false. Not only that,
but I want to be able to calculate that field. For
instance:

Typically, the TOTALUNITS field would be calculated by
using a =Sum[Units]expression. I want to be able to
multiply the TOTALUNITS by .7 if another field (yes/no
field) called MANAGER is = yes. Otherwise, I want to just
sum the field.

I need to do this in the report.

Any ideas?
.
 
Back
Top