Click to See Complete Forum and Search --> : Renaming ADO Tables HELP PLEASE!!
clarkgriswald
Jul 5th, 2000, 01:33 PM
Can someone please help me? I need to know how to simply rename an table using ADO. I can do it in DAO, but I do not know how to do it for ADO. Thanks in advance!
Clunietp
Jul 5th, 2000, 11:12 PM
'uses ado 2.x and ado 2.x for DDL and Security
Dim cn As ADODB.Connection
Dim objCat As ADOX.Catalog
Dim objTbl As ADOX.Table
Set cn = New Connection
Set objCat = New Catalog
'open connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Nwindnew.mdb"
objCat.ActiveConnection = cn
'get table reference
Set objTbl = objCat.Tables("Customers")
'rename it
objTbl.Name = "NewCustomersTableNameHere"
'cleanup
Set objTbl = Nothing
Set objCat = Nothing
cn.Close
Set cn = Nothing
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.