form with no data

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

Guest

I am trying to put The Sum of a field from a subform on a form. If the form
has records everything works fine, but if it doesn't I get an error message.
I have tried Nz(), IIf(IsNull...), but nothing seems to work.

Can somebody help?
 
Claudio,

In a standard module, put the following code...

Public Function nnz(testvalue As Variant) As Variant
If Not (IsNumeric(testvalue)) Then
nnz = 0
Else
nnz = testvalue
End If
End Function

Then, in the Control Source of the textbox on your main form, put the
equivalent of this...
=nnz([NameOfSubform]![NameOfTotalsControlOnSubform])
 
Hi Claudio,

Perhaps this example will be helpful to you:

Displaying Subtotals and a Grand Total on a Form That
Displays a One-to-Many Relationship
http://www.access.qbuilt.com/html/subtotals.html


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

I am trying to put The Sum of a field from a subform on a form. If the form
has records everything works fine, but if it doesn't I get an error message.
I have tried Nz(), IIf(IsNull...), but nothing seems to work.

Can somebody help?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

What do I do if my subform has no data? 5
Parameter Value error in a Subform 0
average of data 1
averaging data 2
Is Null 2
query on blank or range 1
Subform Data Entry Setting 0
#Error 2

Back
Top