change table names

A

Alejandra Parra

I'd like to change a table name in access, using a query.
What I intend to do is change several tables names, using a little
application, that's why I need the query.

Thanks
Muchas gracias

Alejandra Parra
México
 
A

Alejandra Parra

I have an Access Db, but I want to change all table names. They're a lot, so
I want to make a VB .NET application to do the changes to the tables names.
But I don't know if there's a query (Alter Table, Rename, sword of) to do
so.

Thanks

Alejandra Parra
 
A

Andi Mayer

I am not aware of an SQL statement to change the Table names, but jet
give you a few posibities


Sub aaaaaj()
Dim tbl As DAO.TableDef
For Each tbl In CurrentDb.TableDefs
If Left(tbl.Name, 4) <> "MSys" Then tbl.Name = tbl.Name & "test"
Next
End Sub

or
docmd.CopyObject ,"NewName",acTable,"oldName"
docmd.DeleteObject acTable,"oldName"
 
A

Alejandra Parra

GREAT!!! IT HELPED A LOT
THANKS

Andi Mayer said:
I am not aware of an SQL statement to change the Table names, but jet
give you a few posibities


Sub aaaaaj()
Dim tbl As DAO.TableDef
For Each tbl In CurrentDb.TableDefs
If Left(tbl.Name, 4) <> "MSys" Then tbl.Name = tbl.Name & "test"
Next
End Sub

or
docmd.CopyObject ,"NewName",acTable,"oldName"
docmd.DeleteObject acTable,"oldName"
 

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.

Ask a Question

Top