changing a table name

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I have an access project in which I want to change some tables names
dynamically using visual basic code. is there any way doing this?
thank you
 
Yes ... but if you change a table's name, any code relying on that table
will fail.

Assuming you have a reference to DAO set:

Dim tdf As DAO.TAbledef
Dim dbs As DAO.DAtabase

Set dbs = Currentdb
Set tdf = dbs.Tabledefs("YourTableName")
tdf.Name = "NewName"

Set dbs = Nothing
Set tdf = Nothing
 
great!! thanks!
--
dshemesh


Scott McDaniel said:
Yes ... but if you change a table's name, any code relying on that table
will fail.

Assuming you have a reference to DAO set:

Dim tdf As DAO.TAbledef
Dim dbs As DAO.DAtabase

Set dbs = Currentdb
Set tdf = dbs.Tabledefs("YourTableName")
tdf.Name = "NewName"

Set dbs = Nothing
Set tdf = Nothing
 
Back
Top