Adding a Field on the

If you determine that a field does not exist, you can use a pass-through query to add a field to the table:

Sub ADOAddField()

' This adds a grp field to tblReplenish Dim cnn As ADODB.Connection

Dim cmd As ADODB.Command

' Define the connection MyConn = "J:\transfers.mdb" End If

' open the connection

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 'create table cmd.CommandText = "ALTER TABLE tblReplenish Add Column Grp Char(25)" cmd.Execute , , adCmdText Set cmd = Nothing Set cnn = Nothing

End Sub

0 0

Post a comment