change field type

J

Jakob Jünger

Hi,

I'd like to change the field type of one field of all my tables. I think
I have to delete the old one and then create a new one with the new
type.

Since I'm a beginner in VBA I don't even get it to create a new field.
That's what I tried :

Dim myfd As Object
For Each myfd In CurrentDb.TableDefs
Dim newfield As Field
newfield = myfd.createField("NewField", dbInteger)
Fields.Append (newfield)
Next myfd

I created a new module and put this code into a new procedure.

So what's wrong with this? Any help is appreciated.

Jakob
 
Top