Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

calculation between form and subform

1 view
Skip to first unread message

Petri Rahikkala

unread,
Jul 24, 2002, 8:02:27 AM7/24/02
to
Easy bit.

Subform has X pcs. records, i need to sum one field from these records and
bring it to other calculation at the main form.

example


SUBFORM

ID Price
1 3
2 4
3 4

sum value to main form textbox.

Thanks! Someday i can help someone other here =)

Petri

Al Campagna

unread,
Jul 24, 2002, 10:28:29 AM7/24/02
to
Petri,
In the Footer of your subform place a text control (ex. name PriceTotal)
with...
=Sum(Price)
(shows the total of all prices in the subform)
Now, on the AfterUpdate event for the Price field in your subform place
this code...
(use your own names)
Forms!MyMainForm.MyInvoiceTotal = PriceTotal
Every time the Price field in the subform is added/updated, your field in
the Main form will reflect the new total. Your field on the Main form must
be "bound" to a field in your Main form table.
--
HTH
Al Campagna
Candia Computer Consulting
Candia, NH

"Petri Rahikkala" <petri.r...@autocarrera.com> wrote in message
news:nHw%8.192$Ub2....@read2.inet.fi...


---
Outgoing mail is certified by AVG 6.0 as Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.373 / Virus Database: 208 - Release Date: 7/1/02


Petri Rahikkala

unread,
Jul 24, 2002, 10:51:37 AM7/24/02
to
Thanks, this helps a bit.

Altought i need the sum of the ALL records. One record contains one price.

Sum price field from every record. This sum amount i need to have at the
main form to be used in other calculations.

Petri

"Al Campagna" <alanca...@attbi.com> wrote in message
news:uIeXN4xMCHA.2472@tkmsftngp11...

Petri Rahikkala

unread,
Jul 24, 2002, 10:55:44 AM7/24/02
to
I found the solution, i made query for summing the fields. Another problem
is now that at the calculation in subform if have reference to main form,
but the result is only #name?

Petri

"Al Campagna" <alanca...@attbi.com> wrote in message
news:uIeXN4xMCHA.2472@tkmsftngp11...

Al Campagna

unread,
Jul 24, 2002, 11:51:29 AM7/24/02
to
My previous suggestion... sums "all" the prices of the records that are
displayed in the subform recordset.
Given...
Item Price
123-1 1.25
141-2 2.25
132-4 1.50
----------------------
footer... = Sum(Price) in the footer yields 5.00

Now send that value to the field in your main form, as in my previous post.

**Don't forget to Refresh after each Price add/update, to keep your Footer
Sum calculation correct.


--
HTH
Al Campagna
Candia Computer Consulting
Candia, NH

"Petri Rahikkala" <ra...@neutech.fi> wrote in message
news:ahmf5q$4e5$1...@phys-news1.kolumbus.fi...

Adrian M Jansen

unread,
Jul 24, 2002, 8:43:44 PM7/24/02
to
You cant copy the result of a calculated query in a subform to a main form.
But since your query is already returning the value you want, just set the
main form text box to that query.

--
--
Regards,

Adrian Jansen adrianq...@oqzemail.com.au
Design Engineer J & K Micro Systems
Microcomputer solutions for industrial control
Note reply address is invalid, remove q's from address above to reply.

Petri Rahikkala wrote in message ...

0 new messages