format function gives back a string

  • Thread starter Thread starter Jonas
  • Start date Start date
J

Jonas

Hi guys,

does anybody know how can I reach the following effect.
I want to format a floating point number like 45,233 in the way that only
two digits after the comma are show, but they should be there even when the
number in an integer value like 4,00.
So I tried to do it with format(...) but I get back a string.
Type casting the result of format cuts the digits after the comma or rather
distroys the format.

F.e.: 5,6 -> CSng(format(5,67,"#,##0.00")) -> 5,6
but I want to have all my numbers with two digits after the comma as a
number.
Like

4,3 -> 4,30
123 -> 123,00

How can I do that ?

Thanks in advance.

Regards

Jonas
 
Open your table in design view.
Select the number field.
In the lower pane, set:
- the Format property to Fixed
- the Decimal Places property to 2.

You can also set these properties for the text box on a form/report.

In a query, you can also set the Format property of the column to Standard
or #,##0.00 but that's not really a good choice. If you want to control how
the output looks, you really need to create a form - even if the form is in
Datasheet view so it looks like a query.
 
Back
Top