I'm not sure if your expression is in the main or subreport or if you expect
it to display even if there are no records.
First, I would change the "0" to just 0 without the quotes. An IIf() should
not be designed to return either a number or text... pick one.
=Sum(IIf([txtMachineType]="SeCap" And [txtDRSMonth]="01",[sngQuantity],0))
Then I would suggest a small change:
=Sum(Abs([txtMachineType]="SeCap" And [txtDRSMonth]="01") * [sngQuantity])
This will return an error in a group header or footer if there are no
records. The usual solution is to use syntax like:
=IIf(HasData, Sum(Abs([txtMachineType]="SeCap" And [txtDRSMonth]="01") *
[sngQuantity]),0)
--
Duane Hookom
Microsoft Access MVP
"Ann" wrote:
> I'm not familiar with that. Does it somehow have to be part of the following:
>
> =Sum(IIf([txtMachineType]="SeCap" And
> [txtDRSMonth]="01",[sngQuantity],"0")).
>
> I have twelve of these statements, one for every month.
>
> "Duane Hookom" wrote:
>
> > If the subreport doesn't return any records then it will not display in the
> > main report.
> >
> > In a report/group header/footer you often need to use IIf([HasData],...) to
> > get around errors where there are no records in the report/group.
> >
> > --
> > Duane Hookom
> > Microsoft Access MVP
> >
> >
> > "Ann" wrote:
> >
> > > I am using Access 2002. I have created five reports that list totals in the
> > > footer of each for January through December. They are then all on a report
> > > so there is only one report instead of five. They are not linked to each
> > > other.
> > >
> > > All of them show up except one. One of the reports shows nothing at all,
> > > not even the title of the report just a huge blank area where the report
> > > should be. I'm assuming this is because there isn't any data pulled when the
> > > query runs. If I run the report by itself I receive rows of #Errors where
> > > all the calculations are but nothing but blank space when it's run with all
> > > the reports combined.
> > >
> > > Here is the calculation for January, =Sum(IIf([txtMachineType]="SeCap" And
> > > [txtDRSMonth]="01",[sngQuantity],"0")). I thought I would get the "0" but
> > > didn't. I then added Nz infront of Sum hoping that would work but it didn't.
> > > I still just get a hugh blank space where this report is listed. I need to
> > > show that each month has a zero even if there isn't any data. Any help would
> > > be greatly appreciated. Thanks in advance.
|