Change Existing Field Size Property

J

Jessica

Greetings!

I am trying to change the existing size on a text field in my table. This
table is imported in from an ASCII format and originally only has a size of
2. I would like to change the size to 3 so that I can add a preceding letter
to the field. I have been unable to figure out how to change the field size.
I saw how you can set the field size when appending a new field, but I would
like to change the field size on an already existing field. So, does anyone
know how to do this? Or alternatively how to import the file with adding a
field size but not adding the next character in the ASCII file?

Thanks!

Jessica
 
R

Ron Weiner

Jessica;

I feel the easiest way to do this is to execute a DDL query right after
importing the table, before attempting to update the contents. The query
might look like this:

strSql = "ALTER TABLE YourTable " _
& "ALTER COLUMN YourColumn CHAR(3);"
CurrentDb.Execute strSql

The above query will change the column whose name is "YourColumn" in the
table whose name is "YourTable" into a text column that can hold a max of 3
characters.

Ron W
 

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

Top