Code to add a text field not picking up size

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dixie

    Code to add a text field not picking up size

    CurrentDb.Execu te ("ALTER TABLE tblMyTable ADD MyNewField Text 25")

    The above line does not pick up the 25 size, but instead makes it 255.
    What am I doing wrong?

    dixie


  • rkc

    #2
    Re: Code to add a text field not picking up size

    Dixie wrote:
    CurrentDb.Execu te ("ALTER TABLE tblMyTable ADD MyNewField Text 25")
    >
    The above line does not pick up the 25 size, but instead makes it 255.
    What am I doing wrong?
    Enclose the size in parenthesis.

    Comment

    • John Mishefske

      #3
      Re: Code to add a text field not picking up size

      Dixie wrote:
      CurrentDb.Execu te ("ALTER TABLE tblMyTable ADD MyNewField Text 25")
      >
      The above line does not pick up the 25 size, but instead makes it 255.
      What am I doing wrong?
      Try this:

      CurrentDb.Execu te "ALTER TABLE tblMyTable ADD COLUMN MyNewField TEXT(25)"

      --
      '---------------
      'John Mishefske
      '---------------

      Comment

      Working...