Results 1 to 9 of 9
  1. #1
    rockell333 is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Sep 2015
    Posts
    33

    ALTER TABLE rename a column

    I have tried this several ways. still not working


    ALTER TABLE current_addresses
    RENAME COLUMN current_addresses.[Match__Company_Name__c] TO [Co_Name];

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    just go into design mode, rename it.
    no need to use code.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Why do you need SQL action to do this? Open the table in design view and change the name. A process that programmatically modifies db design is often indication of poor structure.

    Apparently Access engine does not support RENAME COLUMN. http://www.dbforums.com/showthread.p...-Rename-Column
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    I'd go to table design and rename the field --simple.

    If you need code, try

    CurrentDb.TableDefs("MyTable").Fields("OldFieldNam e").Name="NewFieldName"

  5. #5
    rockell333 is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Sep 2015
    Posts
    33
    there are more than 30-40 columns to rename and it is a new file every day. I would not want to physically rename them all.

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Then your design is bad. Or you have the wrong tool.

    Tell us more. Describe in simple plain English the "problem/opportunity".

  7. #7
    rockell333 is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Sep 2015
    Posts
    33
    its not a design flaw its the way the file comes to us. i just wanted to rename them to make them easier to read.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Then you will have to use VBA and TableDefs to accomplish. The link I provided has an example.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    How about a few sentences re:
    Tell us more. Describe in simple plain English the "problem/opportunity".

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Alter Table, YES/NO field
    By gmaster in forum Queries
    Replies: 1
    Last Post: 10-29-2014, 03:25 AM
  2. Replies: 8
    Last Post: 07-29-2014, 12:35 PM
  3. rename column header name in subform during run time
    By selvakumar.arc in forum Forms
    Replies: 5
    Last Post: 08-07-2013, 02:40 PM
  4. using macro to rename column values in Access
    By coolbear91 in forum Programming
    Replies: 1
    Last Post: 02-20-2013, 11:10 PM
  5. alter table to add a column in a linked table
    By markjkubicki in forum Programming
    Replies: 6
    Last Post: 02-09-2012, 08:13 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums