P
Peter Hill
Hello,
(using Access 2000)
What I'm trying to do is change a field's data type to
text (for now) through code.
My initial attempt was as follows:
=
Sub Change_Field_Type (table_name As String, field_name As
String)
Dim My_Table As DAO.TableDef
Set My_Table = CurrentDb.TableDefs(table_name)
My_Table.Fields(field_name).Type = vbText
End Sub
=
Unfortunately, it isn't that simple.
I now know why - you have to append a field then set that
data type and move data across to that field then delete
the original field and rename the new one. Is that
correct?
Anyway - what I need to know - is how do I append a new
field to a tabledef and then set it's datatype? And then -
move data across to it?
Regards,
Pete
(using Access 2000)
What I'm trying to do is change a field's data type to
text (for now) through code.
My initial attempt was as follows:
=
Sub Change_Field_Type (table_name As String, field_name As
String)
Dim My_Table As DAO.TableDef
Set My_Table = CurrentDb.TableDefs(table_name)
My_Table.Fields(field_name).Type = vbText
End Sub
=
Unfortunately, it isn't that simple.
I now know why - you have to append a field then set that
data type and move data across to that field then delete
the original field and rename the new one. Is that
correct?
Anyway - what I need to know - is how do I append a new
field to a tabledef and then set it's datatype? And then -
move data across to it?
Regards,
Pete