Code to change Table field names?

S

sbcglobal

I have a table, 'Customer', which I want to use VBA/ADO to auto rename all
the fields. for example, to rename fields 1 to 'customer name', field to
'customer address' ,etc.

in Access, there's query 'Alter table, Alber column' but it only do for
changing column property, say set column as text/number, etc. I don't know
there's way to use SQL to rename a field in table.

I use Access2003 ANSI92. Thanks for any hints!

Warren
**************************************************
The Spoon Does Not Exist.
 
A

Andi Mayer

I have a table, 'Customer', which I want to use VBA/ADO to auto rename all
the fields. for example, to rename fields 1 to 'customer name', field to
'customer address' ,etc.

in Access, there's query 'Alter table, Alber column' but it only do for
changing column property, say set column as text/number, etc. I don't know
there's way to use SQL to rename a field in table.

I use Access2003 ANSI92. Thanks for any hints!

Warren
**************************************************
The Spoon Does Not Exist.

dim tbl as dao.tabledef
dim db as dao.database
set db=currentdb
set tbl=db.tabledef("Customer")
tbl.fields("customer name").name="customer address"
set tbl=nothing
set db=nothing
 

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