Sum of Cost

  • Thread starter Thread starter Cbayardo
  • Start date Start date
C

Cbayardo

Hi, I have this formula in the header of a Grouped Field called Extension
=DSum("[Price]","[February]","[Type] = '2' AND [Extension] = " &
[Extension]) but I get an #Error in the Report. Any ideas why this is
happening?

What I am trying to do is make a report that looks very similar to a Excel
Worksheet.
Name Extension Local Price CellCalls Price International
Price TotalCalls TotalPrice
John 101 52 $125 12 $56 0
$0 62 $181

Something like that.
Local, CellCalls and International are one field, so it gets a little tricky
there. I figured out the Count, but the Price I can´t yet.

Thanks for any help
 
I think using DSum() is a terrible mistake. If you want to sum the Price
field in the [Extension] group footer (or header) where Type =2 just add a
text box with a control source of:
=Sum(Abs([Type]=2) * [Price])
To count the number where Type = 2, use
=Sum(Abs([Type]=2))
 
Thanks for your response, I actually saw your name in a different Forum and
used the Count option with great results, but the Sum of Price does not work
because the price changes with every minute. This is a Phone Call Database.
It records the phone calls made and received. If a Local call is made, the
price is fixed ($1 for example) and the Type = 2, if the call is made to a
cell phone, the price is $1 per minute, and the type = 3 and so on. This
could work if I was able to use the time field and multiply it. Do you know
of any algorithms that can change 00:02:36 into 3 minutes, because after
02:01 it counts as another minute. And 00:00:25 would equal 1 minute and so
on.
I'll keep checking, but if you know of something please let me know,

Thank you again for your response.

*************************
Duane Hookom said:
I think using DSum() is a terrible mistake. If you want to sum the Price
field in the [Extension] group footer (or header) where Type =2 just add a
text box with a control source of:
=Sum(Abs([Type]=2) * [Price])
To count the number where Type = 2, use
=Sum(Abs([Type]=2))

--
Duane Hookom
MS Access MVP


Cbayardo said:
Hi, I have this formula in the header of a Grouped Field called Extension
=DSum("[Price]","[February]","[Type] = '2' AND [Extension] = " &
[Extension]) but I get an #Error in the Report. Any ideas why this is
happening?

What I am trying to do is make a report that looks very similar to a Excel
Worksheet.
Name Extension Local Price CellCalls Price International
Price TotalCalls TotalPrice
John 101 52 $125 12 $56 0
$0 62 $181

Something like that.
Local, CellCalls and International are one field, so it gets a little tricky
there. I figured out the Count, but the Price I can´t yet.

Thanks for any help
 
I think you need to write a user-defined function that contains the logic
and calculations based on minutes and type of call. You can then use this in
the footer or header section like:
=Sum(CalcPrice([Type],[Minutes])
--
Duane Hookom
MS Access MVP


Cbayardo said:
Thanks for your response, I actually saw your name in a different Forum and
used the Count option with great results, but the Sum of Price does not work
because the price changes with every minute. This is a Phone Call Database.
It records the phone calls made and received. If a Local call is made, the
price is fixed ($1 for example) and the Type = 2, if the call is made to a
cell phone, the price is $1 per minute, and the type = 3 and so on. This
could work if I was able to use the time field and multiply it. Do you know
of any algorithms that can change 00:02:36 into 3 minutes, because after
02:01 it counts as another minute. And 00:00:25 would equal 1 minute and so
on.
I'll keep checking, but if you know of something please let me know,

Thank you again for your response.

*************************
Duane Hookom said:
I think using DSum() is a terrible mistake. If you want to sum the Price
field in the [Extension] group footer (or header) where Type =2 just add a
text box with a control source of:
=Sum(Abs([Type]=2) * [Price])
To count the number where Type = 2, use
=Sum(Abs([Type]=2))

--
Duane Hookom
MS Access MVP


Cbayardo said:
Hi, I have this formula in the header of a Grouped Field called Extension
=DSum("[Price]","[February]","[Type] = '2' AND [Extension] = " &
[Extension]) but I get an #Error in the Report. Any ideas why this is
happening?

What I am trying to do is make a report that looks very similar to a Excel
Worksheet.
Name Extension Local Price CellCalls Price International
Price TotalCalls TotalPrice
John 101 52 $125 12 $56 0
$0 62 $181

Something like that.
Local, CellCalls and International are one field, so it gets a little tricky
there. I figured out the Count, but the Price I can´t yet.

Thanks for any help
 
Back
Top