changing field names in tables

L

Lin Light

I need to change a group of field names in a table, on going process, but
would like to make the changes all at once, say in a MACRO.
The fields come in as Field1, Field2,--Field27. Need to change fields
numbers to Names and delete some fields.

Lin
 
D

Douglas J. Steele

I don't believe it's possible using a macro: I think you're going to have to
use VBA.

To rename a field using DAO, use:

CurrentDb.TableDefs("NameOfTable").Fields("NameOfField").Name =
"NewNameForField"

To delete a field using DAO, use:

CurrentDb.TableDefs("NameOfTable").Fields.Delete "NameOfFieldToDelete"
 
Top