Adding a Field with SQL command
Sub ADOAddField()
Dim cnn As ADODB.Connection
Dim cmd As ADODB.Command
MyConn = "C:\mydb.mdb"
End If
Set cnn = New ADODB.Connection
With cnn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open MyConn
End With
Set cmd = New ADODB.Command
Set cmd.ActiveConnection = cnn
cmd.CommandText = "ALTER TABLE tbl1 Add Column Grp Char(25)"
cmd.Execute , , adCmdText
Set cmd = Nothing
Set cnn = Nothing
End Sub
Related examples in the same category