text box default value

ssvec

Registered User.
Local time
Today, 20:37
Joined
Jun 18, 2001
Messages
10
I hope this is a no-brainer. I have several fields from 2 subforms that are added together to display totals on the main form. When 1 subform returns no values, the total calculation displays #Error on the main form. Is there a way to get the fields on the subforms to have a default value of zero so that maybe the total calculations will work? There is no "default value" property available on the fields on the subforms, and I am using Access 2000.
 
Try replacing part of the formula for the control with an Nz statement suchas:

=Sum(Nz(Forms!SubformName!Field),0)+Nz(Otherfield,0))

If the value returned from a subform is null then the Nz function should replace it with zero for you.

Ian

[This message has been edited by Fornatian (edited 08-01-2001).]

[This message has been edited by Fornatian (edited 08-01-2001).]
 
Thanks for your reply. I am already using that Nz statement and it it not working.
 
What function can I use to get the sunform to return Null if it has no records?
 
Lookup HASRECORDS in VBA, may provide you with an answer, otherise you could do something like this:

If Me.RecordsetClose.RecordCount =0 then
'do something
else
'do something else
end if

Ian
 

Users who are viewing this thread

Back
Top Bottom