M
mbr96 via AccessMonster.com
I have three subforms on a main form, each with a text box with a Sum() in
the subform footers. The main form has a total field of all three subform
totals. It works fine, but returns #Error if any of the subform totals are
null. I get that, and I've handled a simpler situation with totals with
nulls, (Iif function to return zero on a field if it's null so a Sum function
will work), but I'm getting an error with the subform refs here for some
reason and I'm stumped.
I simplified this situation with a text box on the main form for just one of
the subform totals instead of all three, and the Iif still fails when that
subform returns no rows. One solution would be to create a blank row for the
subform recordsource to force a zero total, but the underlying queries are
quite complex so that has me baffled too. Any suggestions as to how I can
get the main form total to return zero if the subform has no rows and a null
total? Here's the expression I'm using in the control source property on the
text box on the main form:
=IIf(([Forms]![All]![RegLocActCT3].[Form]![TotMoAct]) Is Null,0,[Forms]![All]!
[RegLocActCT3].[Form]![TotMoAct])
Works fine if RegLocActCT3 has records, so subform ref is okay, but Iif
doesn't return 0?
Any ideas? Thanks alot!
Mbr
the subform footers. The main form has a total field of all three subform
totals. It works fine, but returns #Error if any of the subform totals are
null. I get that, and I've handled a simpler situation with totals with
nulls, (Iif function to return zero on a field if it's null so a Sum function
will work), but I'm getting an error with the subform refs here for some
reason and I'm stumped.
I simplified this situation with a text box on the main form for just one of
the subform totals instead of all three, and the Iif still fails when that
subform returns no rows. One solution would be to create a blank row for the
subform recordsource to force a zero total, but the underlying queries are
quite complex so that has me baffled too. Any suggestions as to how I can
get the main form total to return zero if the subform has no rows and a null
total? Here's the expression I'm using in the control source property on the
text box on the main form:
=IIf(([Forms]![All]![RegLocActCT3].[Form]![TotMoAct]) Is Null,0,[Forms]![All]!
[RegLocActCT3].[Form]![TotMoAct])
Works fine if RegLocActCT3 has records, so subform ref is okay, but Iif
doesn't return 0?
Any ideas? Thanks alot!
Mbr