Programmatically rename tables & fields

B

Brian

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.
 
B

Brian

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"
 

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