Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 55533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:23:32+00:00 2026-05-10T17:23:32+00:00

I want to programmatically create a new column in an MS Access table. I’ve

  • 0

I want to programmatically create a new column in an MS Access table. I’ve tried many permutations of ALTER TABLE MyTable Add MyField DECIMAL (9,4) NULL; and got:

Syntax Error in Field Definition

I can easily create a number field that goes to a Double type, but I want decimal. I would very strongly prefer to do this in a single ALTER TABLE statement and not have to create a field and then alter it.

I am using Access 2003.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T17:23:33+00:00Added an answer on May 10, 2026 at 5:23 pm

    If you want to create a new column in an acces table, it is easy to use the DAO.tableDef object:

    Dim my_tableDef As DAO.TableDef Dim my_field As DAO.Field  Set my_tableDef = currentDb.TableDefs(my_table) Set my_Field = my_tableDef.CreateField(my_fieldName, dbDecimal, myFieldSize) my_Field.decimalPlaces = myDecimalPlaces my_Field.defaultValue = myDefaultValue  my_tableDef.Fields.Append my_Field  set my_Field = nothing set my_tableDef = nothing 

    Of course you can further delete it.

    You might have the posibility to do so with ADODB (or ADOX?) object, but as long as you are working on an mdb file, DAO is straight and efficient.

    PS: after checking on some forums, it seems there is a bug with decimal fields and DAO. http://allenbrowne.com/bug-08.html. Advices are ‘go for double'(which is what I do usually to avoid any loosy issues related to decimal rounding) or use ‘implicite’ ADO to modify your database

    strSql = 'ALTER TABLE MyTable ADD COLUMN MyField DECIMAL (28,3);' CurrentProject.Connection.Execute strSql 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 105k
  • Answers 105k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The first part of this is performing the transformation in… May 11, 2026 at 8:42 pm
  • Editorial Team
    Editorial Team added an answer If you inspect the exe files usine ILDASM you can… May 11, 2026 at 8:42 pm
  • Editorial Team
    Editorial Team added an answer Oh dear. In the implementation of the previous view controller,… May 11, 2026 at 8:42 pm

Related Questions

I want to programmatically create a new column in an MS Access table. I've
I have an IEnumerable(of Employee) with a ParentID/ChildID relationship with itself that I can
I am working on an application which accepts any uploaded CSV data, stores it
I have such task - to create control that union two controls (DataGrid from
Does anyone know if its possible to create a new property on an existing

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.