Change Precision of a Field Within a Table using Visual Basic Code

S

Sarah

Hi,

Does anyone know how to change the precision of a decimal field in an
existing table using visual basic code?

Thanks,

Sarah
 
A

Allen Browne

This should change Field1 into a Decimal field with precision of 28 and
scale of 2:

Dim strSql As String
strSql = "ALTER TABLE MyTable ALTER COLUMN Field1 DECIMAL (28, 2);"
CurrentProject.Connection.Execute strSql

I presume you are aware that JET has no idea how to perform even the most
basic operations reliably with this field type:
http://allenbrowne.com/bug-08.html
 
S

Sarah

Thank you so muck Allen Browne. That worked great!

Also thanks for the insight on decimal fields.

Take care!

Sarah
 
S

Sarah

Thank you so much Allen Browne. That worked great!

Also thanks for the insight on decimal fields.

Take care!

Sarah
 
Top