Rename Access Tables in VB.NET

Category:
Database
Type:
Snippets
Difficulty:
Beginning
Author:
Anonymous

Version Compatibility: Visual Basic.NET

More information:
I was having trouble finding a suitable procedure to rename a table in my Access database so ended up writing my own. It uses the ADOX libraries which can be obtained from Microsoft. My function takes the Access database name, old table name, new table name and attempts to rename the table. It will return any errors it encounters and will not allow renaming an non-existent table nor will it allow you to rename a table to an existing table name. To use it, install the ADOX if not already installed and add a reference to it then add "Imports ADOX" at the top of the VB file.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: