How to sum up all the value in subform and store it in the table?

C

cjnow

How to sum up all the value in subform and store it in the table
although im reading all the topic here also cant solve my problem.
just can show the value using this but didnt store in the table,

control source=[subform].[Form]![sum] 'in textbox name
'temptext'.

And i can show and store in table using this (but the sum amount i
different coz it less add the last value):

Private Sub inv_amount_GotFocus()
inv_amount = temptext
End Sub

am i insert VBA in wrong event or the the other way round?i alread
tried whatever in the event, but still cant , whats the problme here
hope cab been help
 
A

Al Camp

Saving the totals from subform records is unnecessary and redundant.
Since the subform records (and those individual record values) are stored in
your table... you can always re-calculate the total "on the fly" in any
subsequent form,query, or report.
Is there some reason why you want to do this?
hth
Al Camp
 
C

cjnow

is it posible to do that ? becos i need to know the sum of the subfor
for every purchase they made in the table. can we do that
 
A

Al Camp

CJ,
Let's say each sale to a customer has a record, and each record stores
the price in a bound field called Price.
In the footer of your subform, and unbound text control with a
ControlSource of...
=Sum(Price)
would display the total sales to that customer. No need to save the
total... just save each transaction (and Price), and re-add them whenever
you need them.
hth
Al Camp
 
P

Philo Hamel via AccessMonster.com

Check the Northwind sample database to see how, they've made the thing
you're looking for in the Order form/Order Subform.

Good luck!
Philo
 
C

cjnow

ohh thank u very much, they also didnt take the sum of subform in th
table.
One more problem im facing now is:

how can i limit my staff purchase monthly in the invoice form(which t
fill in product that they buy)?

Which mean staff need to register in customer form and hav to fill i
the monthly purchase there. and when come to the invoice form when the
need to buy thing, if they purchase more than the amount that they fil
in in the customer form, they cant proceed and need to do som
adjustment.


How can i limit them in the invoice form, _in_between_that_month_, an
_with_the_same_customer_no_. where should i put the command and how t
write the command? do u understand wat i mean ? sorry for my poo
english. hope u understand.


Thanks for helping here, im glad that i found this forum , its help
lot. Thank
 

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

Top