<p>I am maintaining an app for a client that is used in two locations. One in England and one in Poland.</p>

<p>The database is stored in England and uses the format £1000.00 for currency, but the information is being gathered locally in Poland where 1000,00 is the format.</p>

<p>My question is, in VB6 is there a function that takes a currency string in a local format and converts to another, or will I just have to parse the string and replace , or . ?</p>

<p>BTW I have looked at CCur, but not sure if that will do what I want. </p>

[{'answer_id': 19810, 'author': 'Espo', 'author_id': 2257, 'author_profile': 'https://Stackoverflow.com/users/2257', 'pm_score': 0, 'selected': False, 'text': '<p>What database are you using? And what data type is the amount stored in?</p>\n\n<p>As long as you are always converting from one format to another, you do not need to do any parsing, just replace "." with "," or the other way around. You may need to remove the "£"-sign as well if that is stored in your string.</p>\n'}, {'answer_id': 19854, 'author': 'Kibbee', 'author_id': 1862, 'author_profile': 'https://Stackoverflow.com/users/1862', 'pm_score': 0, 'selected': False, 'text': '<p>There\'s probably a correct answer dealing with culture objects and such, but the easiest way would be to taken the input from the polish input, and replace the , with a ., and then store it in your database as type "money" or "decimal".  If you know they (possibly configurable per user) are always entering numbers in either Polish or English, you could have a function that you run all the input numbers through to convert the string to a proper "decimal" typed variable. Also, for display purposes you could run it through another similar function to ensure that the user always sees the number format they are comfortable with.  The key here is to switch it to a decimal as soon as you get it from the user, and only switch it back to a string at the last step before sending it out to the user.</p>\n'}, {'answer_id': 19868, 'author': 'Espo', 'author_id': 2257, 'author_profile': 'https://Stackoverflow.com/users/2257', 'pm_score': 0, 'selected': False, 'text': '<p>@KiwiBastard yes i would think so. Are you storing your amount in an "(n)varchar" field or are you using a currency/decimal type field? If the latter is the case, the currency-symbols and separators are added by your client, and there would be no need to replace anything in the database.</p>\n'}, {'answer_id': 19920, 'author': 'Joel Spolsky', 'author_id': 4, 'author_profile': 'https://Stackoverflow.com/users/4', 'pm_score': 4, 'selected': True, 'text': "<p>The data is not actually stored as the string <code>&quot;£1000.00&quot;</code>; it's stored in some numeric format.</p>\n<blockquote>\n<p><strong>Sidebar:</strong> Usually databases are set up to store money amounts using either the <strong>decimal</strong> data type (also called <strong>money</strong> in some DBs), or as a floating point number (also called <strong>double</strong>).</p>\n<p>The difference is that when it's stored as <strong>decimal</strong> certain numbers like 0.01 are represented exactly whereas in <strong>double</strong> those numbers can only be stored approximately, causing rounding errors.</p>\n</blockquote>\n<p>The database <em>appears</em> to be storing the number as <code>&quot;£1000.00&quot;</code> because something is formatting it for display. In VB6, there's a function <code>FormatCurrency</code> which would take a number like 1000 and return a string like <code>&quot;£1000.00&quot;</code>.</p>\n<p>You'll notice that the <code>FormatCurrency</code> function does not take an argument specifying what type of currency to use. That's because it, along with all the other locale-specific functions in VB, figures out the currency from the current locale of the system (from the Windows Control Panel).</p>\n<p>That means that on my system,</p>\n<pre><code>Debug.Print FormatCurrency(1000)\n</code></pre>\n<p>will print <code>$1,000.00</code>, but if I run that same program on a Windows computer set to the UK locale, it will probably print <code>£1,000.00</code>, which, of course, is something completely different.</p>\n<p>Similarly, you've got some code, somewhere, I can't tell where, in Poland, it seems, that is responsible for parsing the user's string and converting it to a number. And if that code is in Visual Basic, again, it's relying on the control panel to decide whether &quot;.&quot; or &quot;,&quot; is the thousands separator and whether &quot;,&quot; or &quot;.&quot; is the decimal point.</p>\n<p>The function <code>CDbl</code> converts its argument to a number. So for example on my system in the US</p>\n<pre><code>Debug.Print CDbl(&quot;1.200&quot;)\n</code></pre>\n<p>produces the number one point two, on a system with the Control Panel set to European formatting, it would produce the number one thousand, two hundred.</p>\n<p>It's possible that the problem is that you have someone sitting a computer with the regional control panel set to use &quot;.&quot; as the decimal separator, but they're typing &quot;,&quot; as the decimal separator.</p>\n"}]
['https://Stackoverflow.com/questions/19786', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1075/']