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

how to sum up a field that has been calculated using code 1

Status
Not open for further replies.

newbiess

Programmer
May 23, 2003
10
CA
Hi everyone...this is getting very anoying for me so i hope someone outthere can give me hand with this...i really appreciated everyone help.

anyway...I have created a report and i have a field where the answer is calculated using vba...so for example i created a function called "calMoney()" i passed this into the field to generate the answer. Now my question is that is there anyway that i can sum up all the answer that this field has generated.

To make this a little simpler to understand...say i have 2 fields...1 field is the itemID and the other is the total...Now "calMoney()" would use the itemID to generate an answer...Once everything are finished calculating i want to sum up all the answer that calMoney() generate and put it at the end of the report.
Anyone has an idea?

I've tried making a text box at the end of the form and in the control source of that text box i put
"=sum(the name of the field that i want to add up)" or
"=sum(calMoney())" ... none works

thanx everyone
 
Have a THIRD control in the detail section of the Report and pass the same calculated answer into that control as well as ItemMoney ( Call it SumItemMoney )

Then set the Visible property of this control to NO
Then set the Sum property to OVER GROUP or OVER ALL - depending of which you need

Then in the Group Footer ( Or Report Footer ) add a new control and call it TotalItemMoney.
Now make the ControlSource property = SumItemMoney


QED




G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.
 
OHh man...LittleSmudge you got skillz...i really appreciate it...
thanx all for helpin out.
everything works perfect
 
Hi guys,
I've got the same problem as NewBeiss, and I need to have a field which totals up the subtotals of the calculated field.
What's the Over Group or OverAll Sum property? I can't find it?
Sorry for being a n00bie. Thanks! Help appreciated.
 
blugg - I HOPE you mean you have a CONTROL not a field - because Fields are found in TABLES, it is Controls that are found on Forms and Reports.


The Sum property is a property of text box controls that is only relevant on REPORTS - the property does not exist on Forms. ( It's a pain sometimes - cause I can think of some neat uses for SumOverAll on Forms too. )

So, blugg, if you are working on a Form - give up, you won't find it. If you are working on a Report it is one of the text box's properties.


If you are working on a Form then all is not lost. I'd suggest you start a new thread and explain your problem, what you want, what you've tried ( and Access version ) etc.. and I ( or someone else ) will help from there.



'ope-that-'elps.



G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Ohh u da man LittleSmudge!! I tried it with reports and it works. Ok I'll stick to reports for this. But just out of ignorance, when do you really need to use reports or when do you need forms? I'm doing a time sheet project and each manager wants to key in the timein and time out of workers, so which would suit this? Reports or Forms?
 
FORMS are for use on screens

REPORTS are for use on paper


Yes - you CAN Print Forms - but reports offer a lot more flexibility ( SUM for example )



'ope-that-'elps.



G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Would it be possible for me to enter values using 2 text boxes in a report. Then a 3rd text box calculates the total of the 2 text boxes? How would I do that? Many thanks again LittleSmudge!
 
If text box 1 is called txtFirst and is bound to a field called FirstData in a table,
and text box 2 is called txtSecond, bound to a field called SecondData in the same table,
and the Report is bound to the same table also,

THEN in the third text box called txtThird:-
Set txtThird.ControlSource = [txtFirst] + [txtSecond]

And the report will display the sum of the two in that third control.

'ope-that-'elps.



G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top