Getting rid of the #Error message

Henley12

Troy University Fan
Local time
Today, 06:28
Joined
Oct 10, 2007
Messages
222
I have a field on my main form that shows a total of a field on a subform. If there are no subform records, how do I keep the main form field from showing #Error? Any help would be greatly appreciated.
 
I'm not quite sure I understand where this code is supposed to go:

Function nnz(testvalue As Variant) As Variant
'Not Numeric return zero
If Not (IsNumeric(testvalue)) Then
nnz = 0
Else
nnz = testvalue
End If
End Function

Does it go on the "On Current" event of my main form?
 
From the link:

This function returns zero instead of #ERROR when used like this:nnz([Subf field]) on the main form. I use it from a global module.

So, I would put that code in a standard module and instead of this on your report:

=SubformReference

you'd have

=nnz(SubformReference)
 

Users who are viewing this thread

Back
Top Bottom