Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculations in a report, blank txt boxes stopping result.

Status
Not open for further replies.

Egglar

Technical User
Apr 4, 2002
88
0
0
GB
Hi, just a quick question.

Ive made a report, and ive put in a total txt box, and in the expression builder for that txt box ive put a calculation.

=[PartTotal1]+[PartTotal2]+[PartTotal3]+[PartTotal4]+[PartTotal5]+[PartTotal6]+[PartTotal7]+[PartTotal8]+[PartTotal9]+[PartTotal10]+[PartTotal11]+[PartTotal12]+[PartTotal13]+[PartTotal14]+[PartTotal15]+[PartTotal16]

All the above are txt boxes, and are currency fields relating to a table.

The calculation works fine, when all 16 boxes have values or £0.00 values.

However, i want the boxes to not display a £0.00 value, i want the box to be blank if the value is £0.00. But if the boxes are blank, the calculation in the total does not show up even if just one of the boxes are blank, and the others contain values.

Is there a way and if so how, can i have some blank boxes and some containing values, and it to calculate it properley.

Any help is greatly appriceated.









 
place nz([Field],0) around each of your fields e.g.

=nz([PartTotal1],0)+nz([PartTotal2],0)......

Cheers

B.
 
Hi,

In your report's query you can use to blank any zero values or use the format function:

=IIf([Part1]=0, "",[Part1])

You can use the NZ() function to convert any null values to 0 in your total texbox on your report like:

=Nz([PartTotal1],0)+ Nz([PartTotal2],0)+ Nz([PartTotal3],0)

Have a good one!
BK

 
thanks a lot to both of u, even eaiser than i thought !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top