Column Headers in Access Tables

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?
 
A

Arvin Meyer [MVP]

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,
 
M

Marco Pagliero

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
 

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