MS Access Database with number fields in a foreign language

后端 未结 4 1017
深忆病人
深忆病人 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条回答
  •  -上瘾入骨i
    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. :-)

提交回复
热议问题