Add column to Access Database

yinan

Golden Member
Jan 12, 2007
1,801
2
71
Hello,

I am trying to figure out how to programatically add a column to an Access database. I can read, write, and query the table fine, but I am having trouble adding a new column. The type of column I am trying to add is the "Yes/No" one.

Thanks in advance,
Jim
 

Alex

Diamond Member
Oct 26, 1999
6,995
0
0
To programmatically add a new column, whether using the Microsoft Access Object Library or DAO, first declare an Object (Microsoft Access Object Library) or a Field (DAO) variable. After getting a reference to the table that will receive the new column, assign the CreateField() method of the table to the column's variable. Finally, call the Append() method of the Fields collection of the table and pass it the column variable.

example near the bottom of the page :)
 

yinan

Golden Member
Jan 12, 2007
1,801
2
71
Oops sorry trying to do this in vbscript.

Nice example though thank you.

Jim