Could someone review this code?

cbearden

Registered User.
Local time
Today, 10:05
Joined
May 12, 2004
Messages
84
I don't know code that well.
I'm trying to count for all curGrefund fields in my report. I need to count only those that have a dollar amount. I do not need to count the ones that are $0.00. THis code works but I wanted to make sure there won't be any problems down the line. Thanks for the help.

=Count([curGrefund]>0 Or [curGrefund]=Null)

Do I need both "[curGrefund]"?
I made an unbound text box in the report footer and put this code in the control source.

Note: This DOES give me the answer I want.
 
Actually, the code isn't working. For one thing curGrefund = Null will ALWAYS return false (search for Null in help to get an understanding of why). Plus Count(xxx) counts all records where xxx is not null. For your case, you actually need to use the Sum() function to simulate a count.

=Sum(IIf([curGrefund] > 0 AND Not IsNull([curGrefund]), 1, 0)

The IIf() function will return 1 when the field is not null and it is > 0. Otherwise, the function will return 0. The Sum() sums the 1s and 0s.
 

Users who are viewing this thread

Back
Top Bottom