I don't believe it's possible using ADO or SQL: the ALTER COLUMN DDL
statement doesn't allow for column renames (although you can alter other
properties of a column using DDL)
I don't believe it's possible using ADO or SQL: the ALTER COLUMN DDL
statement doesn't allow for column renames (although you can alter other
properties of a column using DDL)
Set dbCurr = OpenDatabase("....")
dbCurr.TableDefs("MyTable").Fields("MyOldFieldName").Name =
"MyNewFieldName"
ADOX:
I think it's
Dim cnnCurr As ADOX.Connection
Dim catCurr As ADOX.Catalog
Set cnnCurr As New ADOX.Connection
cnn.Open "Provider='Microsoft.Jet.OLEDB.4.0';" & _
"Data Source='...';"
Set catCurr.ActiveConnection = cnnCurr
catCurr.Tables("MyTable").Columns("MyOldFieldName").Name =
"MyNewFieldName"
Set dbCurr = OpenDatabase("....")
dbCurr.TableDefs("MyTable").Fields("MyOldFieldName").Name =
"MyNewFieldName"
ADOX:
I think it's
Dim cnnCurr As ADOX.Connection
Dim catCurr As ADOX.Catalog
Set cnnCurr As New ADOX.Connection
cnn.Open "Provider='Microsoft.Jet.OLEDB.4.0';" & _
"Data Source='...';"
Set catCurr.ActiveConnection = cnnCurr
catCurr.Tables("MyTable").Columns("MyOldFieldName").Name =
"MyNewFieldName"
Dim cat As ADOX.Catalog
Set cat = New ADOX.Catalog
With cat
.ActiveConnection = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=filenamehere;"
.Tables("MyTable").Columns("MyOldColumnName").Name _
= "MyNewColumnName"
End With
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.