Hi,
How could I use VBA with coding to set the decimal places for number field type? I try to set like below but it got error.
Set tbl = dbs.TableDefs("tbltest"
Set fld = tbl.Fields("test"
fld.DecimalPlaces =4
Anyway I don't think you can't achieve your duty like that. In my mind such property can only be set when you create a Table.
Once a table exists and contains data, you must use an SQL statement "ALTER TABLE" in a query.
Unfortunately, I don't find the syntax to set the DecimalPlaces property of a field through ALTER TABLE.
When you change using only VBA code, you must:
Create a NEW field with the new property (ies)
Copy the data of each record from the old to the new field
Delete the old field
Rename the new field as the old one
This would work easily if you no relationship nor indexes on this field....
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.