Change the name of a Field in an Access Table

Per_

Board Regular
Joined
Sep 16, 2011
Messages
90
Hello,

I have two questions:

1) Is it possible to change the name of a field in an access table from Excel?
2) Is it possible to add description for a field in an access table from Excel?

Thanks
/P
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
I would ask first why do you want to change the field name? is the Table connected to queries, forms and reports where it would have a major implication to the whole database.
 
Upvote 0
I'm creating the two tables from an CSV and I need to keep a table with old names. So I would like to change the names. The CSV files is not static with the number of colums.

Are there away to change the fieled names?
 
Upvote 0
You will need to set the Reference in Excel VBA Screen to use Microsoft Access. As you aren't indicating which version of Microsoft you will have to search the list to set the reference.

VBA Code:
Sub ChangeFieldName()
'Set Reference to use Microsoft Access
'Tap Tools and References
'Search the list for Microsoft Access XX - Version number

Dim appAccess As Access.Application
Set appAccess = New Access.Application
With appAccess
'Change the path to the Database location and database name
    .OpenCurrentDatabase "C:\Documents\DatabaseNamee.mdb" 'Using mdb if later version of access change to accdb
    .CurrentDb.TableDefs("tblCheck").Fields(1).Name = "ChangeName" 'Which table and field and change name to ChangeName
    .CloseCurrentDatabase 'Close Database
End With
End Sub
 
Upvote 0
Thank you very very very much Trevor! I appreciate the help very much!

Do you know how to add the description for the field as well?
 
Upvote 0
I haven't dealt with the descriptions before. Take a look at this past thread to see if it helps:

 
Upvote 0

Forum statistics

Threads
1,214,894
Messages
6,122,124
Members
449,066
Latest member
Andyg666

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top