Need help - can't make sum feature work

B

BigBlueMan

I'm using Office XP, and in an Access report I have a list of items, that
have retail prices. I want to put a sum for the entire report of the total
prices of the items.

The field is named 'Retail Price'.

The code I've used in the control source field is
=Sum([Retail Price])
but this keeps giving me an error.

Any help would be appreciated.

Ed
 
D

Dirk Goldgar

BigBlueMan said:
I'm using Office XP, and in an Access report I have a list of items,
that have retail prices. I want to put a sum for the entire report
of the total prices of the items.

The field is named 'Retail Price'.

The code I've used in the control source field is
=Sum([Retail Price])
but this keeps giving me an error.

Any help would be appreciated.

Check the following points:

(1) The summing text box must be in a group or report footer or header
section. Usually it will be in a footer section. Don't put it in a
page footer or header.

(2) The name of the summing text box must not be the same as the name of
a field in the report's recordsource. So if your text box is summing
the [Retail Price] field, as with the controlsource you posted, name it
something like "txtTotalRetail".

(3) The argument of the Sum() function must be a field or an expression
of fields in the report's recordsource; it can't be the name of an
unbound or calculated control. If you have a calculated control, for
example if [Retail Price] is a text box with controlsource
"=[WholesalePrice]+[Markup]", where [WholesalePrice] and [Markup] are
fields in the recordsource, then you must repeat the calculation in the
argument to the Sum() function, as with this controlsource:
"=Sum(WholesalePrice]+[Markup])".
 
B

BigBlueMan

Thanks so much!

My problem was that I was putting it in the PAGE FOOTER. Moving it to the
group footer made it work like a charm!

Ed

Dirk Goldgar said:
BigBlueMan said:
I'm using Office XP, and in an Access report I have a list of items,
that have retail prices. I want to put a sum for the entire report
of the total prices of the items.

The field is named 'Retail Price'.

The code I've used in the control source field is
=Sum([Retail Price])
but this keeps giving me an error.

Any help would be appreciated.

Check the following points:

(1) The summing text box must be in a group or report footer or header
section. Usually it will be in a footer section. Don't put it in a
page footer or header.

(2) The name of the summing text box must not be the same as the name of
a field in the report's recordsource. So if your text box is summing
the [Retail Price] field, as with the controlsource you posted, name it
something like "txtTotalRetail".

(3) The argument of the Sum() function must be a field or an expression
of fields in the report's recordsource; it can't be the name of an
unbound or calculated control. If you have a calculated control, for
example if [Retail Price] is a text box with controlsource
"=[WholesalePrice]+[Markup]", where [WholesalePrice] and [Markup] are
fields in the recordsource, then you must repeat the calculation in the
argument to the Sum() function, as with this controlsource:
"=Sum(WholesalePrice]+[Markup])".

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
E

Eric Blitzer

Thanks Dirk,

I was aware of 1 and 2. 3 was new to me

Erik Blitzer
-----Original Message-----
I'm using Office XP, and in an Access report I have a list of items,
that have retail prices. I want to put a sum for the entire report
of the total prices of the items.

The field is named 'Retail Price'.

The code I've used in the control source field is
=Sum([Retail Price])
but this keeps giving me an error.

Any help would be appreciated.

Check the following points:

(1) The summing text box must be in a group or report footer or header
section. Usually it will be in a footer section. Don't put it in a
page footer or header.

(2) The name of the summing text box must not be the same as the name of
a field in the report's recordsource. So if your text box is summing
the [Retail Price] field, as with the controlsource you posted, name it
something like "txtTotalRetail".

(3) The argument of the Sum() function must be a field or an expression
of fields in the report's recordsource; it can't be the name of an
unbound or calculated control. If you have a calculated control, for
example if [Retail Price] is a text box with controlsource
"=[WholesalePrice]+[Markup]", where [WholesalePrice] and [Markup] are
fields in the recordsource, then you must repeat the calculation in the
argument to the Sum() function, as with this controlsource:
"=Sum(WholesalePrice]+[Markup])".

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.
 
J

Judy Rudek

BigBlueMan said:
I'm using Office XP, and in an Access report I have a list of items, that
have retail prices. I want to put a sum for the entire report of the total
prices of the items.

The field is named 'Retail Price'.

The code I've used in the control source field is
=Sum([Retail Price])
but this keeps giving me an error.

Any help would be appreciated.

Ed

I've not used Access XP, but in earlier versions, this is how I would
do it:

Create a field in the detail line named "PriceSum"
- ControlSource "=[Retail Price]"
- RunningSummary "OverGroup"
- Visible "No"

Create a field in the footer named "GrandTotal"
- ControlSource "=[PriceSum]"

That should work, I think. Kinda hokey, though, so if there's a
cleaner way, I'd like to hear it, too.

-- Judy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top