There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
 
Archive: Business Applications
Tag Cloud
acer backup bios boot bsod computer connection crash dell driver drivers error excel firefox freeze hard disk hard drive hardware hijackthis internet internet explorer keyboard laptop linksys macro malware network outlook outlook 2003 outlook 2007 password problem recovery redirect server slow sound toshiba trojan usb video virus vista vpn windows windows 7 windows vista windows xp wireless youtube
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Business Applications > Archive: Business Applications >
{Solved} Access: Renaming a tables field names with code.

Tip: Click here to scan for System Errors and Optimize PC performance
[ Sponsored Link ]

Closed Thread
 
Thread Tools
Talismanic's Avatar
Senior Member with 412 posts.
 
Join Date: May 2000
Location: Three Rivers, MI
27-Apr-2001, 01:05 PM #1
Is it possible to rename table field names with code. I have a spreadsheet that is beeing imported from Excel and I would like to set the headers once the table is imported into Access.

I know that I can have Access assign the first row as field names but that approach will not work in this case. Any ideas?
Talismanic's Avatar
Senior Member with 412 posts.
 
Join Date: May 2000
Location: Three Rivers, MI
27-Apr-2001, 02:35 PM #2
I did it with a Make Table Query by modifying the SQL like this:

SELECT Jobs.F1 AS JobNumber, Jobs.F2 AS JobName, Jobs.F3 AS Travel, Jobs.F4 AS PW INTO JobNumbers
FROM Jobs;

Thanks anyways!
EAFiedler's Avatar
Moderator with 12,562 posts.
 
Join Date: Apr 2000
28-Apr-2001, 11:25 PM #3
Keep up the good work Talismanic!

I'll mark this one as Solved
YSB's Avatar
YSB YSB is offline
Senior Member with 781 posts.
 
Join Date: Mar 1999
Location: New York City
04-May-2001, 01:04 AM #4
I believe there is another way to do it but I have to try it out first to make sure I don't give you incorrect code. I'm just bringing this thread back to the top so I don't forget to try it when I'm at my other computer.
YSB's Avatar
YSB YSB is offline
Senior Member with 781 posts.
 
Join Date: Mar 1999
Location: New York City
06-May-2001, 04:23 AM #5
Lightbulb Got it!
I tried it out and it works. You can rename a tables fields in code like this:

CurrentDb.Tabledefs("NameOfTable").Fields("OldName").Name = "NewName"
Talismanic's Avatar
Senior Member with 412 posts.
 
Join Date: May 2000
Location: Three Rivers, MI
08-May-2001, 07:43 AM #6
Very cool, YSB. Doing it with code allows me more flexibility.
Closed Thread Bookmark and Share   techguy.org/42845

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Smart Search

Find your solution!



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.

Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -5. The time now is 03:50 PM.
Copyright © 1996 - 2010 TechGuy, Inc. All rights reserved.
Powered by Cermak Technologies, Inc.