Error 2427

  • Thread starter Thread starter arm
  • Start date Start date
A

arm

Hello! Could anyone please help me. I have this subform that has a control
called "txtTotalDesignMhrs" with a control source "=Sum([Design Mhrs])". In
one of the Main form control AfterUpdate event the value of this subform
control (txtTotalDesignMhrs) is assigned to a variable called
"dblTotalDesignMhrs" (see code below:

dblTotalDesignMhrs = me.parent!fsubMySubform.form!txtTotalDesignMhrs

The problem there is this error message that pops up "ERROR 2427 : YOU
ENTERED AN EXPRESSION THAT HAS NO VALUE" and it only shows up whenever there
is no record displayed in the subform. How can I get around this problem?

Thank you very much in advance for the help.
 
If there are no records for a form, and no new records can be added, the
detail section goes completely blank. Then attempting to refer to the
(non-existent) text box [Design Mhrs] causes an error, so the
txtTotalDesignMhrs which makes that reference will contain an error.

You could test for the Error condition, or you could avoid the error like
this:
With me.parent!fsubMySubform.form
If .RecordsetClone.RecordCount > 0 Then
dblTotalDesignMhrs = Nz(!txtTotalDesignMhrs,0)
End If
End With

While that is what is going on in your case, I have oversimplied the
explanation. There is also a design flaw in Access that causes it to mess up
the references in the Form Header and Form Footer sections, even if they
don't refer to a non-existent control in the detail section. More info in:
Incorrect display of data
at:
http://members.iinet.net.au/~allenbrowne/bug-06.html
 
Back
Top