Summing Only negative number in report in access

Lifi

New member
Local time
Today, 22:31
Joined
Jun 4, 2009
Messages
2
Dear all,

In microsoft Access 2007 I have created a Raport based on Query,

in raport i have a "colum" named amount in that colum i have positive and negative numbers ( 355, 556, -100, -366 etc..).

please can you tell me how can i sum only the negative number or only the positive number.


Thanx
Lifi
 
There are several different ways to do this, depending on exactly what you're trying to achieve.

If you want your whole query to only be a summary of records where a negative value exists in that field, just create a totalling/grouping query and put <0 in the criteria row.

If you want your query to address all records, but still have a 'total of negatives' column, then still do a totalling/grouping query, but add a calculated column by entering an expression such as TotalNegs: Iif([yourfieldname]<0,[yourfieldname],0) - then set that column to Sum.

If you just want a footer total (on the report) to be the sum of the negatives, then change the control source of the totalling textbox so it reads something like:
=Sum(IIf([yourfieldname]<0,[yourfieldname],0))
 
Last edited:
There are several different ways to do this, depending on exactly what you're trying to achieve.

If you want your whole query to only be a summary of records where a negative value exists in that field, just create a totalling/grouping query and put <0 in the criteria row.

If you want your query to address all records, but still have a 'total of negatives' column, then still do a totalling/grouping query, but add a calculated column by entering an expression such as TotalNegs: Iif([yourfieldname]<0,[yourfieldname],0) - then set that column to Sum.

If you just want a footer total (on the report) to be the sum of the negatives, then change the control source of the totalling textbox so it reads something like:
=Sum(IIf([yourfieldname]<0,[yourfieldname],0))


Dear Mike,

Thank you so much ,


Best Regards,
Lifi
 

Users who are viewing this thread

Back
Top Bottom