View Full Version : Can I do this? Please help


bluenose76
12-12-2006, 10:54 AM
Hi,

I have a Macro in my database that is used to clear the contents of a table and then subsequently fill the table from an external CSV file.

This is working absolutely great however i would like it to do a little mroe if it is possible?

I would like to have it so that after it has finished all of the above, it will then rename the columns in the table so that i dont have F1, F2 etc etc. if i rename them manually, then once i have run my macro they all return to default?

Please help and advise me on the best method of doign this?

Thank you
Bev

KeithG
12-12-2006, 10:59 AM
You would have to use the TableDef object in VBA to change the fields names.

bluenose76
12-12-2006, 11:02 AM
You would have to use the TableDef object in VBA to change the fields names.


Keith,
Thank you for your reply, I dont suppose there is an example of this anywhere?

This is now showing my lack of experience with Access, I have been using this for three years now and there is soo much more i need to learn.

Thank You

Bev

Rickster57
12-12-2006, 01:00 PM
currentdb.TableDefs("table1").Fields("OldFieldName").Name = "NewFieldName"


Hope this helps

bluenose76
12-12-2006, 01:05 PM
Rickster,

Thank You for this I shall give it a go and see if i can get it working.

Regards
Bev