Results 1 to 2 of 2

Thread: Renaming ADO Tables HELP PLEASE!!

  1. #1

    Thread Starter
    Fanatic Member clarkgriswald's Avatar
    Join Date
    Feb 2000
    Location
    USA
    Posts
    799

    Exclamation

    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!

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    Code:
    '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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width