Count()

D

DS

When I use =Count(*) It returns a value of 1 even if the value of the
record is zero, how do I make it say 0 if the value of the record is
zero. I already have an If statement attached.

="Total Transactions " & "'Discount D' = " & " " & [Discount D] & " (" &
Count(*) & " " & IIf(Count(*)=1,"Discount","Discounts") & ")"

Thanks
DS
 
L

Lynn Trapp

If there is a record present, regardless of any values in the record, then
Count() will return a non-zero value. The only time Count() will return a
zero is when there are zero records in the table that match the criteria
specified.
 
D

DS

Lynn said:
If there is a record present, regardless of any values in the record, then
Count() will return a non-zero value. The only time Count() will return a
zero is when there are zero records in the table that match the criteria
specified.
Right, Anyway to trick it or not activate it unti the record is greater
than 1. What about DCount() ?
Thanks\DS
 
L

Lynn Trapp

DCount might work, but not knowing your data and what you are trying to
accomplish, it's hard to say. Can you post some examples of your data and
what you expect to see returned?
 
D

DS

Lynn said:
DCount might work, but not knowing your data and what you are trying to
accomplish, it's hard to say. Can you post some examples of your data and
what you expect to see returned?
Lynn,
Its simple, I did Count(*)-1
That works!
Thanks
DS
 
D

DS

Lynn said:
If there is a record present, regardless of any values in the record, then
Count() will return a non-zero value. The only time Count() will return a
zero is when there are zero records in the table that match the criteria
specified.
Lynn,
In the If Statement it says that if its "1" its Discount, Anything else
should say Discounts, then, why oh why does "0" say Discount and ot
Discounts? How can I fix it?
Thanks
DS
 

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

Top