Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SUM problem

Status
Not open for further replies.

blindlemonray

Technical User
Nov 24, 2003
130
GB
Hi,

I have this as a control source for a text box in the detail section of a report:-

Code:
=IIf(IsNull([no_of_app]),([hours_actl]))

and it works fine. But I need to total this figure in the footer of the report, so I thought:-

Code:
=Sum(IIf(IsNull([no_of_app]),([hours_actl])))

would work but when the report is previewed it asks for the hours_actl field parameter value.

Can anyone tell my where I am going wrong?

Thanks
 
try summing the results of the text box in the detail section...

--------------------
Procrastinate Now!
 
=IIf(IsNull([no_of_app]),([hours_actl]))
could be written as
=Nz([no_of_app],[hours_actl])

If you are getting prompted for an expression, this generally suggests your expression is not a field in your report's record source. You can't aggregate/sum "controls" across field sections.

What are your fields? What is hours_actl?

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
hours_actl is just a number. I have several fields, most of them are number fields. I was puzzled when it asked me for a parameter coz as you say this normally suggests that the field does not exist. But like I said it works it the details section but not in the footer

"You can't aggregate/sum "controls" across field sections."

^ Does this mean from details section to footer?
 
If you have a text box in the detail section named txtA, you can have other text boxes in the the detail section that use [txtA] in their control source such as:
=[txtA] * 1.05 + 20
However, you can't use that same control source in any other section with an aggregate such as a text box in a footer with a control source of:
=Sum([txtA])

You said "hours_actl is just a number" but didn't actually sugges hours_actl was a field in your report's record source.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top