Changing Field Name

aziz rasul

Active member
Local time
Today, 21:20
Joined
Jun 26, 2000
Messages
1,935
I have a table which has a field name called "MFC". Using VBA, I want to temporarily change the field name to something else form a list of 40 possiblities, export the table and then revert back to "MFC". Can anyone help?
 
If you use a dynamic (on the fly) query you can rename a column just for the diration of that query.

SELECT COL1 as EmpName, COL2 as AGE, COL3 as GENDER

would result in the data shown as EmpName, AGE and GENDER instead of the COL1, COL2 and COL3

Most likely a much more easier approach than renaming the acutal column. But you can do that through the table collection if you just have to.
 
Much easier.Thanks. Can I use a SQL statement in a TransferSpreadsheet method?
 
Last edited:
I don't think it supports that, but you could create temporary querydef object and use that in the transferspreadsheet in VBA. search the forum there are examples on creating a querydef.
 
I've created a SQL statement which produces a table, which I've used in the TransferSpreadsheet statement. Your alternative is also possible. I'll look into that as well. Many thanks for your help.
 

Users who are viewing this thread

Back
Top Bottom