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

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

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

Thanks,

Sarah
 
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
 
Thank you so muck Allen Browne. That worked great!

Also thanks for the insight on decimal fields.

Take care!

Sarah
 
Thank you so much Allen Browne. That worked great!

Also thanks for the insight on decimal fields.

Take care!

Sarah
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top