Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programatically Rename an MS Access 2002 Table? 3

Status
Not open for further replies.

VBAguy22

IS-IT--Management
Aug 5, 2003
180
CA
Hi,
I was just wondering if it was possible to rename a table using a VBA module in Access?
Say I have a table named myTable, and I want to rename it myTableOld.

Thanks!
 
I'm no expert, and there's probably an easier way, but I use something similar to the following in one of my databases:

DoCmd.CopyObject, "myTableOld", acTable, "myTable"
DoCmd.DeleteObject acTable, "myTable"

In effect this creates a copy of the original table and you then delete the original leaving you with a newly named table.
 
After referencing ADOX (Microsoft ADO Extensibility), you get access to Name property of Table object.

combo
 
Why not simply this ?
CurrentDB.TableDefs("myTable").Name = "myTableOld"


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top