Utilizing ADOX to add fields to existing table

J

JNS

I need to add some fields to an existing table in the database. I have tried
implememting the following code in a module. But when I run the code I can
step through with no errors but my existing table is not updated with the new
field. What am I missing? Thanks in advance.

Dim cat As ADOX.Catalog
Dim POTotals As ADOX.Table
Set POTotals = New ADOX.Table
Set cat = New ADOX.Catalog
cat.ActiveConnection = CurrentProject.Connection

POTotals.Name = "POTotals"
With POTotals.Columns
.Append "Test", adInteger
.Refresh
End With

With cat.Tables
.Refresh
End With
Application.RefreshDatabaseWindow
 
P

Patrice

Actually it creates a new table you don't save.

My personal preference would be likely to use the ALTER TABLE SQL
statement...
 

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