Sum expression

G

Guest

I have designed a form and I need to place a text box to calculate the prices
of each record. I added the text box and type in my sum expression. My
problems are either the calculations do not appear or if they appear the
calculation is incorrect. What am I doing wrong?
 
G

Guest

Put the text box in the form footer (to sum the contents of the form) or in
the group footer (to sum the group)
 
G

Guest

That did not work. Is there something else? The formula is fine. I don't
know why it is not working.
 
G

Guest

Try changing the formula to

=Sum ( Nz ([ControlName], 0) )

If this does not work can you post the formula and any other information
(formats, control names, etc)
 
G

Guest

Well I went back a third and put the text book in the footer as you
suggested. It is not calculating it shows a zero. I have 6 fields of items
I named them (item1 item2 and etc) each item has a price field (price1 price2
etc...). In my text box, I wrote the expression
=sum([price1]+[price2]+[price3]+ etc...) hit enter and nothing.

I am willing to try the other formula but what would the control name be?

Wayne-I-M said:
Try changing the formula to

=Sum ( Nz ([ControlName], 0) )

If this does not work can you post the formula and any other information
(formats, control names, etc)

--
Wayne
Manchester, England.



Baderinwa3 said:
That did not work. Is there something else? The formula is fine. I don't
know why it is not working.
 
G

Guest

Hi

You don't do it like that.

If you want to get a sum of 2 text boxes on the same record and have that
shown in that records you would use
=[abc]+[XYZ]

If you want the sum total of all text boxes in each records (the text box is
called - [DEF]) you would use
=Sum ( Nz ([DEF], 0) )
In the group footer to give the sum of the records in that group
In the form footer to give the sum of the records on the form

If you want (as I think you do) to get the sum total of the 3 text boxes
[price1] and [price2] and [price3]
You would use (in the footer)
=Sum ( Nz ([price1], 0) )
=Sum ( Nz ([price2], 0) )
=Sum ( Nz ([price3], 0) )

Note the Nz will give 0 if the there is no data in the box.

To get a sum total of "all" of these use
=(Sum(Nz([prince1],0))+(Sum(Nz([prince2],0))+(Sum(Nz([prince3],0)))))
Of course there are simpler ways to do this but I have used this methods as
it is the best for earning "how it works".






--
Wayne
Manchester, England.



Baderinwa3 said:
Well I went back a third and put the text book in the footer as you
suggested. It is not calculating it shows a zero. I have 6 fields of items
I named them (item1 item2 and etc) each item has a price field (price1 price2
etc...). In my text box, I wrote the expression
=sum([price1]+[price2]+[price3]+ etc...) hit enter and nothing.

I am willing to try the other formula but what would the control name be?

Wayne-I-M said:
Try changing the formula to

=Sum ( Nz ([ControlName], 0) )

If this does not work can you post the formula and any other information
(formats, control names, etc)

--
Wayne
Manchester, England.



Baderinwa3 said:
That did not work. Is there something else? The formula is fine. I don't
know why it is not working.

:

I have designed a form and I need to place a text box to calculate the prices
of each record. I added the text box and type in my sum expression. My
problems are either the calculations do not appear or if they appear the
calculation is incorrect. What am I doing wrong?
 
G

Guest

Great! Yes! Thank you!!! This is helpful for a report. But I still need for
it to total each price per record on the form. I have 18 records right now
and I need the total to reflect each record. When I entered that expression
in the unbound text it totaled every thing in my form for price1.

Wayne-I-M said:
Hi

You don't do it like that.

If you want to get a sum of 2 text boxes on the same record and have that
shown in that records you would use
=[abc]+[XYZ]

If you want the sum total of all text boxes in each records (the text box is
called - [DEF]) you would use
=Sum ( Nz ([DEF], 0) )
In the group footer to give the sum of the records in that group
In the form footer to give the sum of the records on the form

If you want (as I think you do) to get the sum total of the 3 text boxes
[price1] and [price2] and [price3]
You would use (in the footer)
=Sum ( Nz ([price1], 0) )
=Sum ( Nz ([price2], 0) )
=Sum ( Nz ([price3], 0) )

Note the Nz will give 0 if the there is no data in the box.

To get a sum total of "all" of these use
=(Sum(Nz([prince1],0))+(Sum(Nz([prince2],0))+(Sum(Nz([prince3],0)))))
Of course there are simpler ways to do this but I have used this methods as
it is the best for earning "how it works".






--
Wayne
Manchester, England.



Baderinwa3 said:
Well I went back a third and put the text book in the footer as you
suggested. It is not calculating it shows a zero. I have 6 fields of items
I named them (item1 item2 and etc) each item has a price field (price1 price2
etc...). In my text box, I wrote the expression
=sum([price1]+[price2]+[price3]+ etc...) hit enter and nothing.

I am willing to try the other formula but what would the control name be?

Wayne-I-M said:
Try changing the formula to

=Sum ( Nz ([ControlName], 0) )

If this does not work can you post the formula and any other information
(formats, control names, etc)

--
Wayne
Manchester, England.



:

That did not work. Is there something else? The formula is fine. I don't
know why it is not working.

:

I have designed a form and I need to place a text box to calculate the prices
of each record. I added the text box and type in my sum expression. My
problems are either the calculations do not appear or if they appear the
calculation is incorrect. What am I doing wrong?
 
G

Guest

In the form's footer (if you can't see it select view - header and footer)
place one text box for each field in each records
So in each rercord you have fields called
Price1,Price2,Price3 and Price4 you will need to place 4 text boxes in the
footer. If you want to be neat you could line them all up under the
corresponding field.

The control source for each text box will be
=Sum ( Nz ([Price1], 0) ) for the 1st box
=Sum ( Nz ([Price21], 0) ) for the 2nd
=Sum ( Nz ([Price3], 0) ) for the 3rd
=Sum ( Nz ([Price4], 0) ) for the 4th

Add other boxes like this for each field in your form. You need the Nz
function in case any of the records have (or one day "may" have) a null
(nothing in the field). The Nz funtion will put a 0 in place of the Null and
so your sum will still work

Hope this helps
 
G

Guest

I am going to try this will let you know if this helps. Thanks for all your
help. If you have any other ideas please do not hestiate share share
share....

Wayne-I-M said:
In the form's footer (if you can't see it select view - header and footer)
place one text box for each field in each records
So in each rercord you have fields called
Price1,Price2,Price3 and Price4 you will need to place 4 text boxes in the
footer. If you want to be neat you could line them all up under the
corresponding field.

The control source for each text box will be
=Sum ( Nz ([Price1], 0) ) for the 1st box
=Sum ( Nz ([Price21], 0) ) for the 2nd
=Sum ( Nz ([Price3], 0) ) for the 3rd
=Sum ( Nz ([Price4], 0) ) for the 4th

Add other boxes like this for each field in your form. You need the Nz
function in case any of the records have (or one day "may" have) a null
(nothing in the field). The Nz funtion will put a 0 in place of the Null and
so your sum will still work

Hope this helps

--
Wayne
Manchester, England.



Baderinwa3 said:
I have designed a form and I need to place a text box to calculate the prices
of each record. I added the text box and type in my sum expression. My
problems are either the calculations do not appear or if they appear the
calculation is incorrect. What am I doing wrong?
 

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

Similar Threads

Access Query problem 1
Text Box In Report 1
Text Box Problem 3
Form Calculations 2
Calculating averages on a form 3
Trying to Count in a Report 3
Sum Expression 2
Enter Parameter Value in Query 1

Top