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

How do I sum this formula field?

Status
Not open for further replies.

huggybear

Technical User
Joined
Feb 15, 2001
Messages
83
Location
US
I'm using Crystal 11 to query an Access 2k database. I have quite a bit of experience using Access and its built-in report tool but am very new at Crystal.

The objective is to get a total of billable hours of several technicians. In the report I have a formula (@Money) to calculate the billable of each tech:

Code:
dim hours as double, regular as double, rate as currency, otime as double
hours = Sum ({TransService.ServiceHours}, {TransService.ServiceTech})

regular = 40
rate=68

if hours <= regular then
    formula = hours * rate
else
    otime = hours - regular   
    formula = (regular * rate) + ((hours - regular) * (rate*1.5))
end if

That works very well.

Now if I try to create a grand total for all the techs by creating the following formula:

Code:
formula = Sum ({@Money})

the formula editor tells me "This field can't be summarized"

How do I get that grand total?
 
You need to use a variable. In Crystal syntax, you would use a formula like the following in the group (technician) header or footer:

whileprintingrecords;
currencyvar billhrs := billhrs + {@Money};

Then in the report footer you would use the following to display the result:

whileprintingrecords;
currencyvar billhrs;

Not sure how to translate this into Basic syntax...

-LB
 
Thanks LB, that worked like a charm. Turns out I couldn't figure out the Basic syntax so I went ahead and used Crystal.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top