MS Access Database with number fields in a foreign language

后端 未结 4 1014
深忆病人
深忆病人 2021-01-26 12:41

I have a MS Access 2007 database. I have run into an issue (and I\'m sure more will pop up) with some clients in Columbia and Ecuador where their numbering format is different

相关标签:
4条回答
  • 2021-01-26 13:19

    This should be controlled by the locale settings on the local PC. You can set the decimal separator and number grouping separator, and then Access interacts with 1.000,21 in the same way as 1,000.21 in other locales.

    ?Format(1000,"currency")
    €1.000,00
    
    0 讨论(0)
  • 2021-01-26 13:22

    This is an old question and only asked for ms-access but maybe you may encounter a problem similar to mine. Then you may consider below options, too:

    1. This problem may be related to IIS if you are using Access database for your web pages. Thanks to Dmitriy Pavlov's answer Briefly:

      • Open IIS 7
      • Select your website
      • Open .NET GLOBALIZATION
      • From Culture tab, select required Culture and UI Culture.
      • Do iisreset
    2. This problem may be related to Visual Studio settings. Thanks to Jim Mischel's answer Briefly:

    Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", false);

    0 讨论(0)
  • 2021-01-26 13:33

    Ok, here is what I found:

    First of all, I apologize for saying it was a 'type mismatch'. It wasn't. It was an error #2432: "The expression you entered contains invalid syntax, or you need to enclose your text data in quotes". I realize the error was happening on an EVAL() function, which must be done on a string. I was converting the number to a string first, which was treating the "," as a comma instead of a decimal for those with different regional settings for decimals and group separators. In my case the code was:

    If Eval(CStr(cCtl.Value) & ">+" & strMinVal = True Then
    

    So I used IAmBatman's suggestion and did a REPLACE() on the field. Since this is just during the field validation process, it's not changing the actual data, like this:

    If Eval(CStr(Replace(cCtl.Value),",",".")) & ">+" & strMinVal = True Then
    

    Remou, you were right all along. My humble apologies. :-)

    0 讨论(0)
  • 2021-01-26 13:39

    One solution might be to run a replace() on all relevant fields that translate commas into periods if present.

    0 讨论(0)
提交回复
热议问题