Main Control References SubForm Control

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

Hi Folks - I have a Main Form calculated control that references a hidden
subform calculated control that sums a field. Typically, there is no problem
except when the subform does not display any records. If this happens, the
main form calculated control displays #error. I'd prefer is display 0.
What's the best way to handle this? Thanks.

Michael
 
Michael said:
Hi Folks - I have a Main Form calculated control that references a hidden
subform calculated control that sums a field. Typically, there is no
problem except when the subform does not display any records. If this
happens, the main form calculated control displays #error. I'd prefer is
display 0. What's the best way to handle this?

I use Keri Hardwick's nnz() function, posted here:

http://www.mvps.org/access/forms/frm0022.htm
Forms: #Error when the Subform has no records
 
Michael said:
Hi Folks - I have a Main Form calculated control that references a hidden
subform calculated control that sums a field. Typically, there is no problem
except when the subform does not display any records. If this happens, the
main form calculated control displays #error. I'd prefer is display 0.
What's the best way to handle this?


You can do it all in your text box expression using this
kind of thing:

=IIf(subform.Form.Recordset.RecordCount=0, 0,
subform.Form.subtotal)
 
Back
Top