#Error when summing on a sub form

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

Guest

I have a form with two sub-forms. Each sub-form returns a query. In the footer of each of the sub-forms is a sum(fieldname) in the sub-form footer. I also have a control field on the main form that is set the sum value. When the queries return an empty recordset the field is set to #Error. Is there a simple way I can just set the controls' value to zero. I have tried Nz(fieldname,0), but this is not working. Thanks for your help

David
 
I don't know if this qualifies as "simple", but here's something I've used
on occasion:
For a subform control named MySF, set the ControlSource of the textbox
on this main form like this:
=IIF(MySF.Form.Recordset.RecordCount=0,0,MySF.Form.Fieldname)

HTH
- Turtle

dwg said:
I have a form with two sub-forms. Each sub-form returns a query. In the
footer of each of the sub-forms is a sum(fieldname) in the sub-form footer.
I also have a control field on the main form that is set the sum value. When
the queries return an empty recordset the field is set to #Error. Is there a
simple way I can just set the controls' value to zero. I have tried
Nz(fieldname,0), but this is not working. Thanks for your help.
 
Back
Top