Totaling 2 subforms on a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a for which contains 2 subforms each with its own total. Lets stab
subfrm1 and subfrm2. I want to create a total for the master form which
contains subfrm1+subfrm2. The problem is that sometime subfrm1 may not have a
value. For example, if subfrm1 showing previous due balances and there is no
due balance. In this case I will get an #ERROR message in the master total.
Can I put somewhere a defult value of 0 for subfrm1? Is there any other way
to do this?

Thanks,
 
Hi,

The first thing you need to do is create subtotals on your subforms.

subform1subtotal = Sum(yoursubform1fieldtototal)
subform2subtotal = Sum(yoursubform2fieldtototal)

Then on your main form you will code it like this:

frmmaintotal =[subform1name].Form!subform1subtotal +
[subform2name].Form!subformsubtotal

Hope this helps,

Brook
 
Brook,
Thank you for your help.
The issue is that if subtotal for form1 has no value (because that there
were no items with balances), then the mast total will show #ERROR. If there
is a value for form1 I get the total displayed correctly.

Can you help?
Thanks,
Ofer


Brook said:
Hi,

The first thing you need to do is create subtotals on your subforms.

subform1subtotal = Sum(yoursubform1fieldtototal)
subform2subtotal = Sum(yoursubform2fieldtototal)

Then on your main form you will code it like this:

frmmaintotal =[subform1name].Form!subform1subtotal +
[subform2name].Form!subformsubtotal

Hope this helps,

Brook

talofer said:
I have a for which contains 2 subforms each with its own total. Lets stab
subfrm1 and subfrm2. I want to create a total for the master form which
contains subfrm1+subfrm2. The problem is that sometime subfrm1 may not have a
value. For example, if subfrm1 showing previous due balances and there is no
due balance. In this case I will get an #ERROR message in the master total.
Can I put somewhere a defult value of 0 for subfrm1? Is there any other way
to do this?

Thanks,
 
try setting the Default Value for the field to 0,

Brook

talofer said:
Brook,
Thank you for your help.
The issue is that if subtotal for form1 has no value (because that there
were no items with balances), then the mast total will show #ERROR. If there
is a value for form1 I get the total displayed correctly.

Can you help?
Thanks,
Ofer


Brook said:
Hi,

The first thing you need to do is create subtotals on your subforms.

subform1subtotal = Sum(yoursubform1fieldtototal)
subform2subtotal = Sum(yoursubform2fieldtototal)

Then on your main form you will code it like this:

frmmaintotal =[subform1name].Form!subform1subtotal +
[subform2name].Form!subformsubtotal

Hope this helps,

Brook

talofer said:
I have a for which contains 2 subforms each with its own total. Lets stab
subfrm1 and subfrm2. I want to create a total for the master form which
contains subfrm1+subfrm2. The problem is that sometime subfrm1 may not have a
value. For example, if subfrm1 showing previous due balances and there is no
due balance. In this case I will get an #ERROR message in the master total.
Can I put somewhere a defult value of 0 for subfrm1? Is there any other way
to do this?

Thanks,
 
In the form at the settings of the total form1 field? I tried. it does not
work.
:(
--
Ofer Tal


Brook said:
try setting the Default Value for the field to 0,

Brook

talofer said:
Brook,
Thank you for your help.
The issue is that if subtotal for form1 has no value (because that there
were no items with balances), then the mast total will show #ERROR. If there
is a value for form1 I get the total displayed correctly.

Can you help?
Thanks,
Ofer


Brook said:
Hi,

The first thing you need to do is create subtotals on your subforms.

subform1subtotal = Sum(yoursubform1fieldtototal)
subform2subtotal = Sum(yoursubform2fieldtototal)

Then on your main form you will code it like this:

frmmaintotal =[subform1name].Form!subform1subtotal +
[subform2name].Form!subformsubtotal

Hope this helps,

Brook

:

I have a for which contains 2 subforms each with its own total. Lets stab
subfrm1 and subfrm2. I want to create a total for the master form which
contains subfrm1+subfrm2. The problem is that sometime subfrm1 may not have a
value. For example, if subfrm1 showing previous due balances and there is no
due balance. In this case I will get an #ERROR message in the master total.
Can I put somewhere a defult value of 0 for subfrm1? Is there any other way
to do this?

Thanks,
 
Can you give more information on the fields that you are trying to calculate?

What type of fields are they?

For each field that you are calculating the total for, that is where I would
add the default value of Zero.

Brook

talofer said:
In the form at the settings of the total form1 field? I tried. it does not
work.
:(
--
Ofer Tal


Brook said:
try setting the Default Value for the field to 0,

Brook

talofer said:
Brook,
Thank you for your help.
The issue is that if subtotal for form1 has no value (because that there
were no items with balances), then the mast total will show #ERROR. If there
is a value for form1 I get the total displayed correctly.

Can you help?
Thanks,
Ofer


:

Hi,

The first thing you need to do is create subtotals on your subforms.

subform1subtotal = Sum(yoursubform1fieldtototal)
subform2subtotal = Sum(yoursubform2fieldtototal)

Then on your main form you will code it like this:

frmmaintotal =[subform1name].Form!subform1subtotal +
[subform2name].Form!subformsubtotal

Hope this helps,

Brook

:

I have a for which contains 2 subforms each with its own total. Lets stab
subfrm1 and subfrm2. I want to create a total for the master form which
contains subfrm1+subfrm2. The problem is that sometime subfrm1 may not have a
value. For example, if subfrm1 showing previous due balances and there is no
due balance. In this case I will get an #ERROR message in the master total.
Can I put somewhere a defult value of 0 for subfrm1? Is there any other way
to do this?

Thanks,
 
Back
Top