calculated fields problem

G

Guest

tHi,

Thanks to anyone who can help.

I have a main form with 2 'one-to-many' subforms. Both these subforms are
'continuous forms' and have a calculated control (for totalling) in the
footer section.

My problem is that I cannot find a way of configuring another calculated
control in either subform or the main form that subtracts one of the
calculated controls in one subform from the calculated control in the other
subform.

Lets call the mainform 'main' and its subform controls 'subctl1' and
'subctl2' which are associated with subforms called 'sub1' and 'sub2'
respectively, the totalled controls are call tot1 and tot2 respectively. Can
anyone give me a ControlsSource formula that will subtract tot1 from tot2 in
any of the forms?
 
J

John W. Vinson

tHi,

Thanks to anyone who can help.

I have a main form with 2 'one-to-many' subforms. Both these subforms are
'continuous forms' and have a calculated control (for totalling) in the
footer section.

My problem is that I cannot find a way of configuring another calculated
control in either subform or the main form that subtracts one of the
calculated controls in one subform from the calculated control in the other
subform.

Lets call the mainform 'main' and its subform controls 'subctl1' and
'subctl2' which are associated with subforms called 'sub1' and 'sub2'
respectively, the totalled controls are call tot1 and tot2 respectively. Can
anyone give me a ControlsSource formula that will subtract tot1 from tot2 in
any of the forms?

on the mainform put a textbox with a control source:

=subctl2.Form!tot2 - subctl1.Form!tot1

You will probably want to Recalc the mainform in the AfterUpdate event of
*each* subform: Parent.Recalc

John W. Vinson [MVP]
 
G

Guest

Hello John,

Thanks a lot, that worked. For anyone else reading this I found that using
[Parent] in the ControlSource formula enabled me to place the calculated
control on either of the subforms.
 

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