#error when calculating sum

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I keep getting a #error when trying to calculate the sum in my report. I've
made sure the textboxes have different names. The problem I think I have is
the report gets the data from a query.(I only want records between certain
dates.) I've checked my 'way' of summing with the sample database and it is
spot on.

Is there something that I have missed?

By the way I am new, so be gentle.
 
Are you trying to sum something other than a Number field? What are you
doing to calculate the sum?
 
I am using

=Sum([txtrepQuantity]) 'for the control on the summed textbox
(tried the Nz() but no change)

txtrepQuantity 'for the text box in the report
txtfrmQuantity 'for the text box in the form
Quantity 'for the name of the field in the table

Quantity is a number(Long Integer)
 
dstaade said:
I keep getting a #error when trying to calculate the sum in my report. I've
made sure the textboxes have different names. The problem I think I have
is
the report gets the data from a query.(I only want records between certain
dates.) I've checked my 'way' of summing with the sample database and it
is
spot on.

Is there something that I have missed?

By the way I am new, so be gentle.

Is your Sum calculation is in a report footer or section footer? If not (if
it's in the Detail section for example)
it won't work.

Tom Lake
 
I've tried using it in the page footer, which results in the #error, and in
the report footer, which results in me having to enter a number for
txtrepQuantity and then is used for every record and gives me a multiple of
the value entered.
 
dstaade said:
I've tried using it in the page footer, which results in the #error, and
in
the report footer, which results in me having to enter a number for
txtrepQuantity and then is used for every record and gives me a multiple
of
the value entered.

If you're trying to sum a calculated amount (qty*price for example) you have
to repeat the
calculation in the Sum function.

If the following fields are in the Detail section:

Qty Unit Price Total(=[Qty]*[Unit Price])

and you want to sum Total, you have to do this:

Sum([Qty]*[Unit Price])

rather than Sum([Total])

Tom Lake
 
You can't Sum() a text box or other control. You can Sum() an expression
using the fields from the report's record source. I assume txtrepQuantity is
the name of a text box. If this is so, it won't work.

You can use an expression like:
=Sum([Freight] + [Qty] * [UnitPrice] - [Discount])
 
Duane,

You're right that what I was doing wrong.

Thanks.

Duane Hookom said:
You can't Sum() a text box or other control. You can Sum() an expression
using the fields from the report's record source. I assume txtrepQuantity is
the name of a text box. If this is so, it won't work.

You can use an expression like:
=Sum([Freight] + [Qty] * [UnitPrice] - [Discount])

--
Duane Hookom
MS Access MVP
--

dstaade said:
I've tried using it in the page footer, which results in the #error, and
in
the report footer, which results in me having to enter a number for
txtrepQuantity and then is used for every record and gives me a multiple
of
the value entered.
 
Back
Top