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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top