recalc question

C

C Tate

I have a main form with two linked subforms (very like the customer order
form in Northwind 2003). In the footer of the main form is a control which
calculates the amounts entered in one of the subforms to provide an overall
total. It reads =dsum("[funding]","Query1","[siteahid] =" & [siteahid]).
Unfortunately the total won't update unless I scroll to another record.

I have been told on this formum to use recalc. However, I am not sure how to
get it to work at all.

Do I have to put the recalc function on the main form (perhaps in the
afterupdate event) or where? How exactly do I get my calculated control to
update?

Any clear advice (idiot style!) much appreciated.
 
R

Ryan Tisserand

I would take a totaly different approach. This is the way I handle
calculations from subforms. I would put an unbound textbox on the footer of
the subform and the control source would look something like this
Sum([funding]) and name the field TotalFunding. Then on my main form I would
put another unbound textbox and have its control source set to
=[YourSubformName].Form!TotalFunding
Then in the On Activate event of the Main Form you would want requery so
that the total would be updated if you added another record. The code would
look like this.
Me![YourSubformName].Requery

Hope this helps
 
C

C Tate

This is partially what I did actually. However, this only adds up all the
funding for a particular (in this case) group of houses. What the dsum
calculation does is add up the funding for all the groups of houses on a
site. And it is this that will not work/update correctly.

Ryan Tisserand said:
I would take a totaly different approach. This is the way I handle
calculations from subforms. I would put an unbound textbox on the footer of
the subform and the control source would look something like this
Sum([funding]) and name the field TotalFunding. Then on my main form I would
put another unbound textbox and have its control source set to
=[YourSubformName].Form!TotalFunding
Then in the On Activate event of the Main Form you would want requery so
that the total would be updated if you added another record. The code would
look like this.
Me![YourSubformName].Requery

Hope this helps



C Tate said:
I have a main form with two linked subforms (very like the customer order
form in Northwind 2003). In the footer of the main form is a control which
calculates the amounts entered in one of the subforms to provide an overall
total. It reads =dsum("[funding]","Query1","[siteahid] =" & [siteahid]).
Unfortunately the total won't update unless I scroll to another record.

I have been told on this formum to use recalc. However, I am not sure how to
get it to work at all.

Do I have to put the recalc function on the main form (perhaps in the
afterupdate event) or where? How exactly do I get my calculated control to
update?

Any clear advice (idiot style!) much appreciated.
 

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