change data type

  • Thread starter Thread starter David Kennedy
  • Start date Start date
D

David Kennedy

Can anyone tell me how to do this.

I have created a field :
tdf.Fields.Append tdf.CreateField("CountValue", dbText)

I then use an sql string to fill this field.

My question is how do I change the CountValue field to data type dbDouble
after I use the sql string?

Thanks in advance
David k
 
I don't believe you can change a field type through DAO (short of adding a
new field, updating and then deleting the old one).

In JET 4 (Access 2000 and later), you can use a DDL query statement to
change the data type:
strSql = "ALTER TABLE Table1 ALTER COLUMN CountValue DOUBLE;"
dbEngine(0)(0).Execute strSql, dbFailOnError

For a list of the names to use for each field type, see:
Field type names (JET, DDL, DAO and ADOX)
at:
http://members.iinet.net.au/~allenbrowne/ser-49.html
 
Back
Top