supressing zeros in calculated fields

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!!
 
G

Golfinray

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.
 
F

fredg

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
 
M

M. Murphy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top