Formula problem, need some help

vividor

Registered User.
Local time
Today, 07:14
Joined
Aug 5, 2002
Messages
31
I have a report and I created a field name "available COMP TIME"(in hours)..
the formula should be something like this, (total hours earn + Ini comp) - (total hours req)

I was doing something like this "=(sum([hours earn])+([ini comp]))-sum([hours req]) , but
is not right.. can some one assist me on this formula. thanks
 
Ooops!!

Should have been

=Sum(sum([hours earn]+[ini comp])-sum([hours req]))
 
For some reason I am getting an #ERROR If I have do not have a record on (INI COMP), also
(HOURS EARN) is duplicating the value, for example, I enter (5 hours earned) on the report it shows
10 hours earned
 
Hi there,

Firstly the reason for the #Error is (I think) that you are trying to calculate a result that includes a Null. If you have a zero in [INI COMP] then it should work i.e. prove that theory.

As for the formula, are you wanting to calculate each record in the report?

If so the try = [hours earn]+[ini comp]-[hours req]

If you're calculating totals then try = Sum([hours earn]+[ini comp])-Sum([hours req])

Post again if it doesn't work

Rob
 
If you don't want to convert your nulls to zeros in the data, you can do this in the formula using the Nz function.
 
Neileg, How does the Nz function works?
can you make an example for me?

Can I put that function on the report or queries?
 
vividor,

Nz(YourField, 0)

Will return 0 if YourField is Null.

Wayne
 
Wayne is correct. You can use this in any formula, in queries or forms or reports. The second parameter, ,0 defaults to zero so you can omit this for simplicity.
 
vividor said:
Neileg, How does the Nz function works?
can you make an example for me?

Can I put that function on the report or queries?


In the control source?

=Nz(fieldname,0) ?????
 

Users who are viewing this thread

Back
Top Bottom