Edit a table structure using vb code or an access macro

Gary_Mc_Mahon

Board Regular
Joined
Apr 30, 2003
Messages
87
Hi,

I trying to alter the field names, formats and aa fields within a table once its been imported into my database.

Is there any way to do it using the macro builder, or can it be done using vbcode in the same way a qry def can be created by setting the sql and assigning a qry name.

Thanks
Gary
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Gary

Take a look at TableDefs.

It is a collection of all the TableDef objects in the database.

Each of the TableDef objects has a Fields collection.

This will give you access to each field in the table but I'm not sure what, if any, properties you can change.

For example I know you can't change the size of the field.

Another approach could be to create a new TableDef based on the original fields but with the properties changed as required.

You could then use an append query, or other method, to put the data in the new table.
 
Upvote 0

Forum statistics

Threads
1,221,848
Messages
6,162,419
Members
451,765
Latest member
craigvan888

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