Alter name of Column in a table

Posted on 2011-10-28
Last Modified: 2012-05-12

I know there are ways to alter the attributes of a column in a table and I have done that.

What I want to do now is from within VBA load the table then alter the names of some of the fields in the table after I know the data that is loaded into them.

I want to export the table to an excel spreadsheet.  When I do that the names of the fields are used as column headers.  I want to chnaae the names of the fields to represent what is in the column so the exported spreadsheet has the correct column names.

Any given experiment will be tested against different materials.  Some experiments may test against only two materials, some may test against 5.

Initial table


Might become
Question by:mlcktmguy
    LVL 84
    Use a query to do your export, and you can then "alias" the column names as you wish. For example:

    SELECT Col1 AS [First Name], Col2 As [Last Name] FROM YourTable

    This would create a query with two columns titled "First Name" and "Last Name", with the data coming from Col1 and Col2 respectively. Save that query, and use that when doing your Export.
    LVL 39

    Accepted Solution

    You can test this example:
    Open form1, correct sub in Form's code (in example files are saved to c:\tmp)
    LVL 1

    Author Closing Comment

    Exactly what I need with full coding examples

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
    I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
    Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
    Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now