Subform Totals

  • Thread starter Thread starter ShrekUT
  • Start date Start date
S

ShrekUT

I have a form (Customers) setup with one subform (InvoiceSub), whic
shows Invoice Details for that customer. I have a text box (InvTotal)o
the subform which sums (using "=SUM(TOTAL)) the Invoice Totals for al
records in the filter. Back on the customer form I have another tex
box which uses "=[InvoiceSub].[Form]![InvTotal]". The totals show u
fine when there are records for the subform but I get #Error when ther
are no records in the subform. I have fried things like changing th
control source of the subform's text box t
"=IIf([InvoiceSub].[Form].[Recordset].[RecordCount]>0,Sum([PAID]),0)
but this gives me a #Name? result in the customer form's text box.
Can anyone please help
 
ShrekUT said:
I have a form (Customers) setup with one subform (InvoiceSub), which
shows Invoice Details for that customer. I have a text box (InvTotal)on
the subform which sums (using "=SUM(TOTAL)) the Invoice Totals for all
records in the filter. Back on the customer form I have another text
box which uses "=[InvoiceSub].[Form]![InvTotal]". The totals show up
fine when there are records for the subform but I get #Error when there
are no records in the subform.


You didn't say what you want to happen when the subform has
no records, but presuming you want a zero in the main form,
this should work:

=IIf(IsError(InvoiceSub.Form!InvTota), 0,
InvoiceSub.Form!InvTotal)
 
Thank you Marshall. That should work just fine. I don't know that
would have ever thought of that. :) :
 
Thank you Marshall. That should work just fine. I don't know that I
would have ever thought of that. :) :)
 
Back
Top