当前位置: 动力学知识库 > 问答 > 编程问答 >

How to change number of decimal places stored in a table's field ms-access 2013 VBA?

问题描述:

I have a macro that formats my table, changes the field names and does a few other formatting operations before I push the data to a MySQL database. Now I want to be able to change the number of decimal places stored in the table to 2 numbers after the decimal. My field name is "Quantity". Is there a property I can use to set this in VBA? I have a web page that sits on the MySQL database, so I want to do all of the operations and other fixes in the Access db so that when I push the data, it is all ready to go.

Thanks in advance!

网友答案:

Run an UPDATE query like this:

UPDATE myTable
SET Quantity = Round([Quantity], 2)
网友答案:
  1. There are no 2 dec digits data type in Acs. 4-fixed-digit only is Currency. If you need exactly 2 - you need to have two fields - Long for Integer part, and Byte - for decimal, I guess...
  2. Please, keep in mind that proposed Round([Quantity], 2) is Banking, not school (standard) rounding!

    ? Round(12.5)
    12
    ? Round(13.5)
    14

.

分享给朋友:
您可能感兴趣的文章:
随机阅读: