Counts in Queries (0 vs. null)

S

sue

How can I get a count to be "0" instead of null. Right
now, if my query returns no records (i.e. null) it causes
everything else on my form to be blank. I would like the
count to be "0" if there are no records. Any help would
be MUCH appreciated.
Thanks,
Sue
 
J

JL

I guess that you are using a "Count" or "Dcount" function.
This is what I have done to check for null values.

sub TESTING ()
dim ctr as integer

if IsNull(Dcount("fieldname", "tablename", "criteria"))
then
ctr = 0
else
ctr = Dcount("fieldname", "tablename", "criteria"))
end if
end sub

Hope it helps.
 

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


Top