I need to display a number (real), ie 1234.567 like "1.234,56" or "1,234.56". I know that I have to use Format() but I can't figure it out.
(It's for a textbox where the 'Control Source' property is set to some number field)
views:
267answers:
1
+1
A:
This should do it:
Format(number, "#,##0.00")
Where the actual separators used depend on the current locale setting.
Tomalak
2009-06-11 13:59:29
Since I can't currently find the according MSDN page, here a nice 3rd party documentation of Format(): http://www.apostate.com/vb-format-syntax
Tomalak
2009-06-11 14:03:44
Hm... was not so hard to find, after all: http://msdn.microsoft.com/en-us/library/aa262745(VS.60).aspx ... It's just not very helpful, unfortunately.
Tomalak
2009-06-11 14:11:38
There is another link that might be helpful. It contains MS ACCESS user defined numeric formats: http://msdn.microsoft.com/en-us/library/4fb56f4y(VS.80).aspx
Joe Suarez
2009-06-11 14:28:17
Perfect, that was it.
Tomalak
2009-06-11 15:41:24
Sorry for the delay... I am trying to use "#,###.##" in the textbox's Format property but it's not working. Any ideas?
Nick D
2009-06-11 15:44:21
Oh, I thought you wanted to use the VBA Format() function. In the Access UI textbox property, the decimal and thousands separators are locale-specific as well. Using "#.##0,00" may be worth a try. In any case this specific format is named "Standard", so putting in the word "Standard" into the property should work as well. Pressing F1 when you are in the "Format" property field fires up the help, which has good guidance to offer as well.
Tomalak
2009-06-11 16:26:24
Thanks Tomalak.
Nick D
2009-06-11 23:17:48