Gustav Brock
Gustav at cactus.dk
Sat Oct 22 06:18:10 CDT 2005
Hi John You can build the string piece by piece but I mostly use Format(): strValue = Format(curValue * 100, "0\,00") This is hardcoded for comma as decimal separator and two decimals. As Stuart points out, you would probably need something more generic: Const cstrFormatEscape As String = "\" lngDecimals = 2 strDecimal = "," For lngChar = 1 to Len(strDecimal) strFormatDecimal = strFormatDecimal & cstrFormatEscape & Mid(strDecimal, lngChar, 1) Next strFormat = "0" & strFormatDecimal & String(lngDecimals, "0") strValue = Format(curValue * 10 ^ lngDecimals, strFormat) This will not give a thousand separator and Format() can not be used for that here. On the other hand, I have never seen an export specification requiring a thousand separator - on the contrary, it must not exist. /gustav >>> jwcolby at ColbyConsulting.com 21-10-2005 21:51:55 >>> OK, so how do you handle this when you format a currency string? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Friday, October 21, 2005 2:57 PM To: accessd at databaseadvisors.com Subject: Re: [AccessD] Data Export Spec - Rev1 Hi John No, we can use Format() just fine. It's just that you can't rely on it for formatting decimals when exporting to a text file as the specs for this will require one specific format (say dot for the decimal point which is quite often used for mainframes) while Format() will deliver whatever is set on the user's machine. /gustav >>> jwcolby at ColbyConsulting.com 21-10-2005 17:25 >>> Gustav, I am assuming that the format$() will work just fine assuming that you are using this in Denmark, then the strings you use to format allow you to use Danish formatting constructs? Are you saying that you cannot use Format$() because it doesn't work anywhere but the US? If that is the case, then people outside of the US will need to work with the team to explain how you guys accomplish formatting. John W. Colby www.ColbyConsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Friday, October 21, 2005 10:39 AM To: accessd at databaseadvisors.com Subject: Re: [AccessD] Data Export Spec - Rev1 Hi John You would need to address the good old internationalization task here as well. Over here, this example will output $23.423,00 ... /gustav >>> jwcolby at ColbyConsulting.com 21-10-2005 15:56 >>> For example, if a field needs to be currency, placing the format$ "$###,###.00" gives an output in the text string of $23,423.00, etc etc.