I would like to change some MS Access table field's properties in VBA codes, but when I try to change properties value "Type" or "Size", VBA calls error Number 3219 - "Invalid operation". I understand that these properties in VBA are read only, but maybe exist any solution of this. It's very important for me that it could be possibly to solve this problem.
Code example. (I want to change structure of old table like other new one)
****************************
Sub ChangePropertyValue(fldNew as Field)
Dim tdf as TableDef
Dim fld as Field 'Field of Old Table
Dim prp as Property
Set tdf=currentDB.TableDefs("OldTable"
Set fld = tdf.Fields(fldNew.Name)
'Change field position
Set prpNew = fldNew.Properties("OrdinalPosition"
Set prp = fld.Properties("OrdinalPosition"
prp.Value = prpNew.Value 'Here program works normally
'Change field type
Set prpNew = fldNew.Properties("Type"
Set prp = fld.Properties("Type"
prp.Value = prpNew.Value '>>>>>>>>>> Here VBA call error No 3219 - "Invalid operation"
'Change field size
Set prpNew = fldNew.Properties("Size"
Set prp = fld.Properties("Size"
prp.Value = prpNew.Value '>>>>>>>>>> Here VBA call error No 3219 - "Invalid operation"
End sub
Code example. (I want to change structure of old table like other new one)
****************************
Sub ChangePropertyValue(fldNew as Field)
Dim tdf as TableDef
Dim fld as Field 'Field of Old Table
Dim prp as Property
Set tdf=currentDB.TableDefs("OldTable"
Set fld = tdf.Fields(fldNew.Name)
'Change field position
Set prpNew = fldNew.Properties("OrdinalPosition"
Set prp = fld.Properties("OrdinalPosition"
prp.Value = prpNew.Value 'Here program works normally
'Change field type
Set prpNew = fldNew.Properties("Type"
Set prp = fld.Properties("Type"
prp.Value = prpNew.Value '>>>>>>>>>> Here VBA call error No 3219 - "Invalid operation"
'Change field size
Set prpNew = fldNew.Properties("Size"
Set prp = fld.Properties("Size"
prp.Value = prpNew.Value '>>>>>>>>>> Here VBA call error No 3219 - "Invalid operation"
End sub