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

Basic but needed answer

Status
Not open for further replies.

Gavroche00

Technical User
Feb 4, 2004
49
0
0
US
Good day all,

Would anyone tell me why, in a report, when a text box has a control source and a name, I can sum the controlsource and not the name? If the control source in the table is called TOTAL and I give it the name txtTotal, why can't I get another unboud textbox to be =sum('txttotal') when of course =sum([total]) works.

Let me rephrase it another way, Can I ever reference a text box through its name to be used in another calculated field?

David
 
David
Yes, you can reference a text box through its name, to be used in other calculations.

For example, the following refers to 3 other text boxes in order to do a total.
=[Text95]-[Text70]+[Text114]

I think it's the "sum" part that's getting in your way. "Sum" totals the control source, not the name.

Tom
 
You can't sum controls from one section to another. When you get out of the section, you are mostly out of scope for the aggregate functions.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Duane,

When you write 'section', you mean from detail to footer for example?

David
 
Yes, that is what I mean. Your experiences are typical. You can't sum controls from one section to another. There are other methods if we knew what you expected to accomplish.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Duane,

Thank you for the message. All I am trying to do is is sum a list of expenses that are record specific. However, if I create the sum in the detail section, I get the sum of all the records.

Rent: 30
Fuel: 40
Taxes: 10

Total should be 80 but it is instead the sum of all 3 fields (rent, fuel and taxes) for all the records. So I figured that if I put the sum in the footer, then it works. However, to do so, I can't use the name of the field but must use the control source of the field - thus the original question. Is there a more efficient way to do what I am doing?

Thank you

David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top