Column Headers in Access Tables

  • Thread starter Thread starter LL
  • Start date Start date
L

LL

I imported a large group of files into separate tables but the files did not
have any column headers. Is there any way to update the column headers from
each of these tables (through a update query, etc) without having to manually
go into each table and rename each column header?
 
No, but you can write some code to do it if your imports are consistent
enough. If there are column headers in the original, I suggest you re-import
them with the first row being set as a column header,
 
I imported a large group of files into separate tables but the files did not
have any column headers. Is there any way to update the column headers
from each of these tables (through a update query, etc) without having to
manually go into each table and rename each column header?

If all files have the same column structure, try this way.

Dim FName(20) As String
FName(0)="FirstName"
FName(1)="LastName"
FName(2)="Birthday"
....
FName(20)="Balance"

Dim dbs As Database,
Dim tdf As TableDef
Dim tbl As Table
Dim fld As Field

Set dbs = CurrentDb
For Each tbl In dbs.TableDefs
Set tdf = tbl.name
For Each fld In tdf.Fields
I = fld.OrdinalPosition
fld.Name(I) = FName(I)
Next fld
Next tbl
 
Back
Top