Alter field properties thru code

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

Guest

I have a table that I create by running a Make-Table query. My problem is
that after I make this table, I have to open it in Design View and change
every field type to Text, and set each field to a specific length (different
for each field). The reason for this is that the table is later exported for
use with another application. It takes quite a bit of time to do this and
I'd like to automate it, if possible. I tried setting field properties when
I was in Query Design View, but it doesn't let me choose Text or set the
length. Is there a way I can alter the table via code after I create it?
 
The simplest way would be to set up the table exactly as you want, and then
use an Append query to add the records to this table. This means that it
retains the correct design.

You can then clear the data out of the table (but leave it intact for the
next append) with:
dbEngine(0)(0).Execute "DELETE FROM Table1;", dbFailOnError

That sounds to me like it would be much easier than using an ALTER TABLE to
fix the problem after it's created each time:
"ALTER TABLE MyTable ALTER COLUMN MyText2Change TEXT(255);"
 
Back
Top