CoStar
asked on
How to change field type in VB?
I need to change the field types in another database and can't get my code to run (Runtime error '3219' - invalid operation)
Set tdf = dbs.TableDefs!Jobs
Set fld = tdf("Description")
Set NewProp = fld.Properties("Type")
NewProp.Type = dbText
fld.Properties.Append NewProp 'Error occurs here
Set NewProp = fld.Properties("Size")
NewProp.Properties("Size") = 100
fld.Properties.Append NewProp
The field is currently a Memo field and I want to change it to a text field (Size:100). Can anyone help please
Set tdf = dbs.TableDefs!Jobs
Set fld = tdf("Description")
Set NewProp = fld.Properties("Type")
NewProp.Type = dbText
fld.Properties.Append NewProp 'Error occurs here
Set NewProp = fld.Properties("Size")
NewProp.Properties("Size")
fld.Properties.Append NewProp
The field is currently a Memo field and I want to change it to a text field (Size:100). Can anyone help please
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you frankytee, this worked very well and on the first attempt. My grateful appreciation. An extra 100 points to you.
Regards
CoStar
Regards
CoStar
you're welcome and thanks for the bonus
field, update this new field's values from the original field, delete the original field, then rename
new field.