supressing zeros in calculated fields

  • Thread starter Thread starter M. Murphy
  • Start date Start date
M

M. Murphy

Hi,
I'm an acess hack, trying to finish a project.
I know just enough to get myself in trouble!!

Making a report, which extends pricing (quantity * price = extended price)
the extended price is a calculated field, and that works fine. I can even
total up the exetended (calaulated)fields at the bottom!!
My issue is that I have total of 7 possible items on the report, and if I
don't use the full 7 I get a bunch of zeros on my report. I was able to use
this code for the quantity and price fields to supress the zeros:
If Me.quantity_2 = 0 Then
Me.quantity_2.Visible = False
Else
Me.quantity_2.Visible = True
End If
That works, but not for the calculated field. I get errors, and I think I
understand why, so my question is:
how do I supress the zero in a calculated field?

TIA!!
 
Try using the nz, or no zeroes command. Do a search here and you should find
plenty of examples. Or go to the access help for nz.
 
Hi,
I'm an acess hack, trying to finish a project.
I know just enough to get myself in trouble!!

Making a report, which extends pricing (quantity * price = extended price)
the extended price is a calculated field, and that works fine. I can even
total up the exetended (calaulated)fields at the bottom!!
My issue is that I have total of 7 possible items on the report, and if I
don't use the full 7 I get a bunch of zeros on my report. I was able to use
this code for the quantity and price fields to supress the zeros:
If Me.quantity_2 = 0 Then
Me.quantity_2.Visible = False
Else
Me.quantity_2.Visible = True
End If
That works, but not for the calculated field. I get errors, and I think I
understand why, so my question is:
how do I supress the zero in a calculated field?

TIA!!

Set the Format property of the control in the report tp:
#.00;-#.00;""

If you don't wish it to show the 2 decimals just use
#;-#;""

Look ip Format Property + Number and Currency datatypes
 
Thanks fredg, worked perfectly.


fredg said:
Set the Format property of the control in the report tp:
#.00;-#.00;""

If you don't wish it to show the 2 decimals just use
#;-#;""

Look ip Format Property + Number and Currency datatypes
 
Back
Top