
10-17-2001, 06:49 AM
|
|
Contributor
|
|
Join Date: Apr 2001
Location: Montreal, Canada
Posts: 428
|
|
Adding field with ADOX
|
I'm trying to add a field to a table using ADOX. Adding the field is easy but I can't figure out how to set its default value. What should I add to the following code?
Dim oCat As ADOX.Catalog
Dim oTable As ADOX.Table
Dim oColumn As ADOX.Column
Set oCat = New ADOX.Catalog
oCat.ActiveConnection = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= MyDatabase.mdb;"
Set oTable = oCat.Tables("MyTable")
Set oColumn = New ADOX.Column
With oColumn
.Name = "NewField"
.Type = adUnsignedTinyInt
End With
oTable.Columns.Append oColumn
Set oColumn = Nothing
Set oTable = Nothing
Set oCat = Nothing
Thanks!
|
|