Access 2013 form field value gets cut off on changing the number before the point

寵の児 提交于 2019-12-12 02:48:38

问题


Recently I created a form which loads some records from an SQL (linked) database.

I want to display some field values (which are decimal numbers - 30,2 in the sql server).

The values are loaded in the form and displayed with a comma for the decimals and a point as a 1000 separator like this: 5.222,55. (Language settings on the computer).

Though the thing is, when I change the 5 before the point into any number then the value gets truncated and it sees the point as the decimal separator. So for example, if I only select the number 5 on the 5.222,55 number (so I leave the point) and then change it to a 2, the value is changed to 2,22.

Though when I select the whole number or the first number AND the point then it changes correctly. So how can I get this right? The easy way is to just select the whole number on changing but I just want it to work in every way. Perhaps I can achieve it with VBA? I tried setting the format option (back in access 2000 I believe I could set the text field to long integer or currency or something but I cant find this in the access 2013 field properties).

Additional information:

  • I am linking with a SQL server 2012,
  • The linked table in Access sees the fields record source (the SQL fields) as short text (while they are decimals in the SQL server)

回答1:


Access cannot handle a 30,2 decimal, thus it is converted to text by teh ODBC driver.

So, either convert back and forth between text and numerics with Str and Val (the C* functions won't do), or change the data type of the field in SQL Server to, say, Money (= Currency in Access).



来源:https://stackoverflow.com/questions/33172239/access-2013-form-field-value-gets-cut-off-on-changing-the-number-before-the-poin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!