0 value returned if no record found

D

Dave

I have two combo boxes that filter my records and return a single numerical
value.

What I want is the filter to return 0 if it finds no record. Is this possible?

Thanks again for the help.

Dave
 
R

Rainbow01

from Rainbow01 Hong Kong

u can use NZ(Null to Zero) function
u can find it in Access Help

"Dave" 來函:
 
M

Michel Walsh

Hi,


Public Function ZeroIfNone( rst As DAO.Recordset)
If 0=rst.RecordCount then
ZeroIfNone=0
else
ZeroIfNone= rst.Fields(0).Value
End If
End Function




Since if you have no record, you have no ... value, you can't use Nz, since
Nz operates on a value which is NULL, you cannot apply it to ... absence.



Hoping it may help,
Vanderghast, Access MVP
 
K

Klatuu

First, if you build a filter form a form that returns no records, then
Me.Recordset.Recordcount will return 0

Second the function below makes absolutely no sense.
 
Top