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

Simple: Getting a total for a column in an Access Report 1

Status
Not open for further replies.

lsgko

Programmer
Sep 9, 2002
111
US
I've got an access report and I need to get the total for a column that is displayed in the report. I've tried =Sum([Query]!Expr2) but I get an error.

How do I get the total?
 
Go into design view of your report
from the toolbox place a text box into the footer of your Report
=Sum([YourTextBoxName])
should work

Hope this helps
Hymn
 
Maybe I'm doing it wrong but that doesn't seem to work.
 
YOu can't sum a text box. You can sum a field from the report's record source. The text box with the sum should go in a group or report header or footer section.
=Sum([TheFieldName])
This will not work in a page footer. Also, the name of the text box must not be the name of any field.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
If you still do not have it working

Go into design view of your report
from the toolbox place a text box into the footer of your Report
In the Properies of the textbox, you placed in the report footer under Control Source type =Sum([yourFieldName]) that
should work

Hope this helps
Hymn
 
What if the field is a "Open/Close" type of field and you wanted the total number of Open Only?
 
There is no such field type as "Open/Close". There are text, yes/no, date, currency,... field types. If a field value is "Open" then I expect the field type is text. To count the records in a report where the [ValveStatus] = "Open", use a text box in a group or report footer bound to the expression:
=Sum(Abs([ValveStatus]="Open"))



Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Still not quite getting it. Suppose I have a text box with a name of Widgets and the control source is "=[query1]". I'm trying to put a total for the column that is generated. Based on the above this should be a text box with a control source of =sum([Widgets]).
Instead of working I get prompted for the value of Widgets. Why does this happen?

 
You can't set a control source to the name of a query. Also, you can't sum a textbox or any other control. You can sum fields or expressions created from fields.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Thank you so much! This was my very first post/question. Your answer worked perfectly. Thank you again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top