Subform Default Value

B

Becca

I have created a sum calculation in a subform that is then referenced in the
form. Is there a way to have the calculation return a 0 value if no records
are present in the subform?
I have changed all the default values to 0 in the properties and have tried
the formula =Sum(Nz([ActualAmount], 0)) without success.
If I enter a record in the subform with value 0 everthing works, but I don't
want to have to do that for every record.
Thanks in advance for your suggestions!
 
S

Sprinks

Set the main form control's ControlSource to:

=IIf(IsNull(YourSubformSummaryField),0,YourSubformSummaryField)

Sprinks
 
B

Becca

This worked PERFECTLY for one subform, but won't work for the other. When I
run the main form, a 0 and the correct calculation flashes and then goes
away. There is no error, just an empty field. Does this make sense at all?

Thanks so much for your help!


Sprinks said:
Set the main form control's ControlSource to:

=IIf(IsNull(YourSubformSummaryField),0,YourSubformSummaryField)

Sprinks

Becca said:
I have created a sum calculation in a subform that is then referenced in the
form. Is there a way to have the calculation return a 0 value if no records
are present in the subform?
I have changed all the default values to 0 in the properties and have tried
the formula =Sum(Nz([ActualAmount], 0)) without success.
If I enter a record in the subform with value 0 everthing works, but I don't
want to have to do that for every record.
Thanks in advance for your suggestions!
 
Top