On a report I have a control which is bound to a column which can have up to 3 decimal places.

I want the number to format with commas separating thousands and millions, but I also want the number of decimal places to be automatic, so that if there is no decimal portion then no decimal at all is shown.

1234.567 -> 1,234.567
1234.560 ->  1,234.56
1234.500 ->   1,234.5
1234.000 ->     1,234

General format will give me the auto decimal places but no commas. Standard format gives the comma but is fixed to 2 decimal places. Doing my own =Format(Number, "#,##0.#") leaves the decimal point in and doesn't align properly, with extra space on the right of the number.

Do I have to write my own VB function to give the format I want? It seems silly that Access (apparently) can't do this out of the box.

This also seems really horrible, though it works.

=Replace(Replace(Replace(Replace(Replace( _
  Format(Number, "#,##0.000") & "x", _
  "0x", "x"), "0x", "x"), "0x", "x"), ".x", ""), "x", "")
link|improve this question
feedback

1 Answer

up vote 2 down vote accepted

Put this in the textbox format property: #,###.###

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.