Utilizing ADOX to add fields to existing table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Actually it creates a new table you don't save.

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