Subform Default Value

G

Guest

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!
 
G

Guest

Set the main form control's ControlSource to:

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

Sprinks
 
G

Guest

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!
 

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