Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you change a field size in code?

Status
Not open for further replies.

Rohdem

Programmer
Sep 20, 2000
553
US
Is it possible to change the size of a field using vbcode? I am working on a utility that will allow me to create tables, add fields to tables, and, hopefully, change the size of fields in exisiting tables. The utility will run overnight so no users will be in the databases. I have the table creation and field append parts working, but I am unable to change the size of an existing field.

Thanks
Mike Rohde
rohdem@marshallengines.com
 
I just had a quick look in the access help, & it suggests this is possible using the DAO size property. If you open the help file & search for the fieldsize property, this might help.... James Goodman
j.goodman00@btinternet.com
 
I have also tried to do this. If you get it to work I will be very interested. However I am under the impression that this is not possible.

I have a not so elegant solution that is:

1. Add a new column to the table (setting the field size upon creation)
2. Copy the data in
3. Remove the old column.

This idea is in a couple of microsoft books/websites/helpscreens which is why I think that the simple process of just changing the field size directly is not possible.
 
The 'size' property is read only except before you append a field to the tabledefs.

I apologize because I posted this question in this forum a few months ago and got the same answer, but I forgot about it. I must be losing my mind!!! :) I think I have it backed up on disk somewhere!!! LOL You have to add a column, copy the data, and rename it.

Thanks guys!!
Mike Rohde
rohdem@marshallengines.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top