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!

I am stupid 4

Status
Not open for further replies.

FunnyGuy

Technical User
May 26, 2003
19
CA
Hi,

I am new to Access and I am trying to create something very simple but because I am stupid, I am having trouble. What I am doing is creating a textbox with an expression in a calculated control source on a report. This is how it reads:

= a * b * c (These are all fields in a table)

Now all I was trying to do is, in my footer of my report, I am trying to sum up my calculated fields to each page that it creates. Is there a way to create this, or am I going about this the wrong way? Can I place this calculation in my table somehow and pull those values out instead? Any help would be appriciated!
Thanks!
 
The best way for me to answer this is to have you open Access Help and type "calculate fields" (without the quotes) in the search box. The topic, "Ways to perform calculations in a query" is fairly extensive. And there is a topic about using calculations in reports. Holler back if this doesn't do it for you.
 
The grand total can be calculated i a textbox in the report header/footer:
=Sum(a*b*c)

As for page totals, it's a bit more complicated, as the formula throws an #error in Page footer. You will have to use a textbox (I'll call it txtRunningTotal) in the detail section (Running Sum property =OverAll):
=a*b*c

Place a textbox in the Page footer:
=txtRunningTotal
It will display the total accumulated by the end of each page.

To display page totals (only for what's displayed on each page), you need some code to transfer the total from one page footer to the next page header.

To display each page totals in the report footer, you need some advanced code - store the data in an array. Let it aside for now...

HTH


[pipe]
Daniel Vlas
Systems Consultant

 
Thanks for the replys!

Dan, I have the total working...that works great now, but it is not really the expected total I was anticipating! When I set the running sum property = overall, it ends up totaling every line previous for me. eg:
line 1 2*2*2 = 8
line 2 2*2*2 = 16
line 3 nil*nil*nil=16
total = 16

What I am intending to show is :
line 1 2*2*2 = 8
line 2 2*2*2 = 8
line 3 nil*nil*nil= 0
total = 16

I have also now experimented with an update query to calculate my weight an place it in my totals so my text box just reads the field. It seems like an extra step when I can just calculate it in my report, but maybe there is an easier way to do what I am trying to do with the table filled out already?

Am I doing something wrong with the running sum?


 
Hi guys,

CosmoKramer, your code is fabulous! I should of thought of that myself! Thank you very much. I have programed a bit but I am totally new to access and I have thrown myself in head first! That is exactly what I needed.

Thanks again!

Funnyguy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top