Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regional settings impact on currency conversion

Status
Not open for further replies.

tkupfer

Programmer
Dec 18, 2002
14
0
0
US
I have a VB 6.0 application storing U.S. dollar fields on a SQL Server database into columns of the "money" datatype. This app will now be used in countries that use settings with the comma as a decimal separator, etc. I want to treat these money fields as U.S. dollars regardless of regional settings but, despite various tweaks of "CCur", "Format" and the ADO connection string, cannot get this done. Any suggestions are appreciated!
 
You should treat them as dollars but use the system Country settings for the decimal and thousand seperators.

If you really want this, then:

For data currently stored in a string variable in US format with a dot as a decimal seperator
?Format$("1.23","0\.00")

or

For data already formated with a comma as decimal seperator(such as when stored in a Currency or Single variable, or comming from the DB already formated)
?Str("1,23")

I STRONGLY suggest using this only for screen display purposes, or passing data back to the db, but not for calculations in VB6 when the system is set in a different format! (i.e 1.23 would convert to 123)
 
I am able to display data from the database OK using the "GetCurrencyFormat" API, but storing data is a problem. The receiving parameter in the stored procedure is type "money", and no matter how I try to save a value like 1.23, it winds up 123 if I'm using a setting such as Dutch (Netherlands), where the decimal separator is a comma. Is there any way to override this conversion?
 

try using the UPDATE statement like this:

comm.Execute "UPDATE MyTable SET USDollarValue=" & "1.23" & " WHERE MyRecordID='MrDollar1'"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top