Programmatically rename tables & fields

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

Guest

As part of distributing updates to applications, I have a need to rename a table and several fields. How do I do this programmatically? I did find sample code showing how to create a table in the MS KB using DAO (CreateTableDefs), but the Access 2002 VBA help provides no help on DAO, so I cannot find any modify/rename functions.
 
I found the answer myself, elsewhere. Here it is, for anyone else who needs it:

Rename field: currentdb.TableDefs("MyTable").Fields(<FieldNumber>).name="NewFieldName"
Rename table: currentdb.TableDefs("MyTable").name="NewTableName"
 
Back
Top