RE: *REPOST* If then Else Statment in Report



If there are records but the value might be null, use:
=Nz(SumOfExpr4,
0)+IIf(rptORRMonthlyBirthsCountSubreport.Report.HasData,rptORRMonthlyBirthsCountSubreport.Report.CountOfEarTag,0)),0)

Do yourself a favor and take the time to give appropriate names to your
expressions.

--
Duane Hookom
Microsoft Access MVP


"Thorson" wrote:

"SumOfExpr4" Is a field in the query "qryMonthlyReportPG1ORR" that the Main
Report is built on. Expr4 is in a query "qryORRMonthlyDispositionRecords"
before that one, Expr4 is an equation: Expr4:
IIf((tblDispositionRecords!DispMethod="Transferred"),(qryORRMonthlyDispositionRecordsTransferred!Expr3),([Head]))

I just never changed the name of it. "SumOfExpr4" in qryMonthlyReportPG1ORR
sums up the field Expr4 in qryORRmOnthlyDispositionRecords.

Since the "SumOfExpr4" is a field I tried using the IsNull() Formula, but
I'm not quite sure how to set it up. Also as you can see from the orginal
equation the Sum of SumOfExpr4 is added to the subreport Births Total.

I would also like the equation to still add the number of births even if
"SumOfExpr4" is null.

--
Thorson


"Duane Hookom" wrote:

Where is SumOfExpr4 from? Is this a control or field or what? "Expr4"
displays a lack of effort and maintainability.

The HasData property is for reports. A report (or subreport) has this
property. A field or control can be checked for data using IsNull().

--
Duane Hookom
Microsoft Access MVP


"Thorson" wrote:


Someone tried helping me out with this before, but we couldn't get the
equation he suggested to work:

I currently have an if then else statment in my report that adds the sum of
another field to the sum of animal births (if animal births has data). I
would however like this whole equation to=0 if nothing is reported, however
instead it has an #error.

I thought that edited the equation would solve the problem but I'm not sure
how to edit it. This is the orginial eqation:
=(Sum([SumOfExpr4]))+IIf(rptORRMonthlyBirthsCountSubreport.Report.HasData,rptORRMonthlyBirthsCountSubreport.Report.CountOfEarTag,0)

This is what I tried editing it to, and it didn't work:
=IIf((SumOfExpr4.HasData),((Sum([SumOfExpr4]))+IIf(rptORRMonthlyBirthsCountSubreport.Report.HasData,rptORRMonthlyBirthsCountSubreport.Report.CountOfEarTag,0)),0)
--
Thorson
.



Relevant Pages

  • RE: *REPOST* If then Else Statment in Report
    ... Report is built on. ... Expr4 is in a query "qryORRMonthlyDispositionRecords" ... "SumOfExpr4" in qryMonthlyReportPG1ORR ... another field to the sum of animal births. ...
    (microsoft.public.access.reports)
  • RE: *REPOST* If then Else Statment in Report
    ... I changed the name of Expr4 to NumberOfHead, therefore SumOfExpr4 changed to ... Report is built on. ... another field to the sum of animal births. ...
    (microsoft.public.access.reports)
  • *REPOST* If then Else Statment in Report
    ... I currently have an if then else statment in my report that adds the sum of ... another field to the sum of animal births. ...
    (microsoft.public.access.reports)
  • If Then Else Statment in Report
    ... I currently have an if then else statment in my report that adds the sum of ... another field to the sum of animal births. ...
    (microsoft.public.access.reports)
  • Re: If Then Else Statment in Report
    ... My report still returns the answer as #Error ... "Carl Rapson" wrote: ... another field to the sum of animal births. ...
    (microsoft.public.access.reports)

Loading