suming up text box from other text boxes that have a sum formula

suming up text box from other text boxes that have a sum formula

Post by ryan.fitzp » Fri, 11 Apr 2008 06:45:03


I have three text boxes, i.e. "text box C" that sums up "text box A"
and "text box B".

I have a text box at the bottom of the sub form that sums up the
values for "text box C"
Text box C is called tboxextcost.

so I did =sum([tboxextcost]) but the result gives a 0 back. What am I
doing wrong? Thanks.

Ryan
 
 
 

suming up text box from other text boxes that have a sum formula

Post by Marshall B » Fri, 11 Apr 2008 07:39:29


I would have expected an error from that. The aggregate
functions( Count, Sum, etc) only operate on fields in the
form/report record source table/query. They are unaware of
controls in a form/report.

Instead of:
=Sum(tboxextcost)

Assuming the expression in tboxextcost is
=txtboxA + txtboxB
then you should use:
=Sum(txtboxA + txtboxB)

--
Marsh
MVP [MS Access]

 
 
 

suming up text box from other text boxes that have a sum formula

Post by ryan.fitzp » Sat, 12 Apr 2008 00:38:42

That didn't work. It gave an error.

textboxa = tboxPercofComp
textboxb = UnitPrice
textboxc = ExtCost <--sums up a * b = c

At the bottom of the form page is a textboxd = extcosttotal
this should sum up all the ExtCost text boxes, but like you mentioned
since it's not on a record of any kind it shows up as a blank, but
since I put =Sum(Nz([ExtCost],0)) it shows up as 0. I did what you
mentioned for the extcosttotal text box and put =Sum(tboxPercofComp*
UnitPrice) but this gave me an error.

Ryan
 
 
 

suming up text box from other text boxes that have a sum formula

Post by Marshall B » Sat, 12 Apr 2008 04:10:00


You can not use (text box) ***controls*** in an aggregate
function.

I still don't know what the names of the record source
***fields*** are, but I'm guessing it should be:

=Sum(PercofComp * UnititPrice)

--
Marsh
MVP [MS Access]
 
 
 

suming up text box from other text boxes that have a sum formula

Post by ryan.fitzp » Sat, 12 Apr 2008 06:59:32

Got it thanks!!