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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sum calculated fields in a report

Status
Not open for further replies.

gavin31

Programmer
Mar 14, 2004
28
IE
The group detail of my report contains all the employees' details - e.g. name, start time, end time and a text box named "hours" that subtracts start time from end time. This is all OK.

In the footer for this group I have a text box named "employeesHours"

The value for employeesHours I want to make a running sum by calculating the sum of all the "hours" text boxes.

It works when I use
=Sum([endTime]-[startTime])

but not when I use
=Sum([hours])

Can I not refer to the calculated control in this way??
Why???
Please help
 
No, you can't Sum() a control. You can only Sum() an expression comprised of fields from 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]
 
Ok thanks for confirming that. Bit annoying as I wanted to use the calculated control to go on and calculate further results.

I may now try to do this in the code module as the expressions get very long in a later calculated control.

Gavin

 
Code in report events designed to create aggregate values is generally not very successful. You are much better off using expressions in control sources.

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