Re: Using If/When type expressions in a report

From: John Spencer (MVP) (spencer4_at_comcast.net)
Date: 04/30/04


Date: Thu, 29 Apr 2004 21:32:10 -0400


  = Sum(IIF(Manager = -1, .7,1)*[Units])

Saskatoon wrote:
>
> 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?
> >.
> >



Relevant Pages

  • RE: writing records to a table
    ... It is an access report where the control source is the form. ... "Shari" wrote: ... The me.v fields are the unbound and the me. ... In the bound text box I have the control source set to table name. ...
    (microsoft.public.access.forms)
  • Re: Still Hoping for help with a Query problem
    ... In the header of the report you could put two unbound text boxes. ... Set the label for the second text bot to "and" and the Control Source to the ... "Forms!frnName.controlName" in the Control Source of the text boxes. ...
    (microsoft.public.access.forms)
  • Using If/When type expressions in a report
    ... Use an unbound text box ... Set the control source to ... >sum the field. ... >I need to do this in the report. ...
    (microsoft.public.access.queries)
  • Re: help with control source
    ... You cannot change a control's control source property while the report ... I would suggest you leave the control source blank (use an unbound ... If it is in the report's detail section, code the Detail Format event: ...
    (microsoft.public.access.reports)
  • Re: Include number of records found in report
    ... replacing the asterisk with the name of a valid field in the report's ... > in the control source of an unbound text box but the text box dispalys ... >>> I want to include in the report the number of record found. ...
    (microsoft.public.access.reports)