Multiple Decimal Place Formats on Report

P

PPCO

I want to format a number on a report so that if it is greater than 50, then
it has 0 decimal places, but if it's less than 50 it has 2 decimal places. I
tried a couple of expressions that I found here, but couldn't get it to work.
Thanks
 
F

fredg

I want to format a number on a report so that if it is greater than 50, then
it has 0 decimal places, but if it's less than 50 it has 2 decimal places. I
tried a couple of expressions that I found here, but couldn't get it to work.
Thanks

Using an unbound control, try:
=IIf([FieldName]>=50,Format([FieldName],"#"),Format([FieldName],"#.00"))
 
P

PPCO

It says syntax error comma in expression.

fredg said:
I want to format a number on a report so that if it is greater than 50, then
it has 0 decimal places, but if it's less than 50 it has 2 decimal places. I
tried a couple of expressions that I found here, but couldn't get it to work.
Thanks

Using an unbound control, try:
=IIf([FieldName]>=50,Format([FieldName],"#"),Format([FieldName],"#.00"))
 
J

John W. Vinson

If you have a version of Access using something other than the US conventions,
you may need to replace the commas in this expression with semicolons.
It says syntax error comma in expression.

fredg said:
I want to format a number on a report so that if it is greater than 50, then
it has 0 decimal places, but if it's less than 50 it has 2 decimal places. I
tried a couple of expressions that I found here, but couldn't get it to work.
Thanks

Using an unbound control, try:
=IIf([FieldName]>=50,Format([FieldName],"#"),Format([FieldName],"#.00"))
 
K

Klatuu

As an alternative:

=format(x,iif(x>50,"0","0.00"))

fredg said:
I want to format a number on a report so that if it is greater than 50,
then
it has 0 decimal places, but if it's less than 50 it has 2 decimal
places. I
tried a couple of expressions that I found here, but couldn't get it to
work.
Thanks

Using an unbound control, try:
=IIf([FieldName]>=50,Format([FieldName],"#"),Format([FieldName],"#.00"))
 
P

PPCO

Where do I use this expression? In the control source?

Klatuu said:
As an alternative:

=format(x,iif(x>50,"0","0.00"))

fredg said:
I want to format a number on a report so that if it is greater than 50,
then
it has 0 decimal places, but if it's less than 50 it has 2 decimal
places. I
tried a couple of expressions that I found here, but couldn't get it to
work.
Thanks

Using an unbound control, try:
=IIf([FieldName]>=50,Format([FieldName],"#"),Format([FieldName],"#.00"))
 
K

Klatuu

Yes

PPCO said:
Where do I use this expression? In the control source?

Klatuu said:
As an alternative:

=format(x,iif(x>50,"0","0.00"))

fredg said:
On Thu, 23 Oct 2008 09:18:26 -0700, PPCO wrote:

I want to format a number on a report so that if it is greater than
50,
then
it has 0 decimal places, but if it's less than 50 it has 2 decimal
places. I
tried a couple of expressions that I found here, but couldn't get it
to
work.
Thanks

Using an unbound control, try:
=IIf([FieldName]>=50,Format([FieldName],"#"),Format([FieldName],"#.00"))
 

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