#Error when summing on a sub form

D

dwg

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
 
M

MacDermott

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.
 

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