#Error when subform has no data

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

Guest

Greetings,

My main form has two subforms. I am trying to add values from controls on
the two subforms into a control on the main form. Here is the expression I'm
using:

=Nz([Sections].[Form]![SectionTotal],0)+Nz([Labs].[Form]![LabTotal],0)

The expression works fine as long as both subforms have data. Frequently,
however, one of the subforms will not have data, generating an error in the
expression. It appears the HasData property only works for reports. Is there
a comparable function I can use for forms?

Any help will be appreciated.

jn
 
jnew said:
My main form has two subforms. I am trying to add values from controls on
the two subforms into a control on the main form. Here is the expression I'm
using:

=Nz([Sections].[Form]![SectionTotal],0)+Nz([Labs].[Form]![LabTotal],0)

The expression works fine as long as both subforms have data. Frequently,
however, one of the subforms will not have data, generating an error in the
expression. It appears the HasData property only works for reports. Is there
a comparable function I can use for forms?


A rather glaring lack of symetry between forms and reports
here.

Instead of HasData, you can use:
RecordsetClone.RecordCount > 0
 
Back
Top