Re: Modify a field data type
IMHO you have to change the underlying table definition using SQL or the Access GUI.
Re: Modify a field data type
I think that this from the Visual Studio help file explains your problem:
"For a Field or Property object, [the type] property is read/write until the object is appended to a collection or to another object, after which it's read-only."
In other words, since your field object is part of the tabledef.fields collection, you can't modify the type property.
The only solution I can think of is not pretty: 1) Create a new field object and set its properties. 2) Save all the data from the old field into an array. 3) Delete the old field. 4) Append the new field to the database's tabledefs collection. 5) Write the saved data back to the database.
Charlie Zimmerman
http://www.freevbcode.com
[email protected]