Rename a field in a table

  • Thread starter Thread starter Andrew
  • Start date Start date
A

Andrew

Hi,

Via code how do I rename a field in a table (Tbl_Table) from
Original_Filedname to New_Fieldname?
 
Andrew said:
Hi,

Via code how do I rename a field in a table (Tbl_Table) from
Original_Filedname to New_Fieldname?


You can do it via DAO. For example:

Dim db As DAO.Database
Dim tdf As DAO.TableDef

Set db = CurrentDb
Set tdf = db.TableDefs("Tbl_Table")
tdf.Fields("Original_FieldName").Name = "New_FieldName"

Or, in a shorter form:

CurrentDb.TableDefs("Tbl_Table").Fields("Original_FieldName").Name = _
"New_FieldName"
 
Thanks fredg but I wanted to rename fieldnames - Dirk provided the answer in
the above thread.
 
Back
Top