databasevb6daodata-access-object

Change DAO DBEngine DataTable's column from DataType dbInteger to dbLong in VB6


I've inherited a legacy VB6 app to maintain, and my vb6 is more than a little rusty...

I've got a DAO Table that had a field of type DAO.DataTypeEnum.dbInteger that needs to be altered to type DAO.DataTypeEnum.dbLong. Is there a shortcut vb6 way of setting this new data type and retaining the existing values, or do I need to create a temp column to store the data, then remove and recreate the column with the new datatype and then migrate the data by hand?


Solution

  • If this is a one time job, you could open the Access database and change the datatype.
    Add a comment to this post, otherwise.

    EDIT: You could issue an ALTER statement on the database object

    CurrentDb.Execute "ALTER TABLE myTable ALTER Column myIntegerColumn Long"