Adding a column to a database

D

dlossing

I'm having trouble adding a column to my database. I have tried the help
option in Access, but it doesn't give me the option to insert column. Can
someone please help?
 
B

Brendan Reynolds

I'm assuming this question is about adding a column programmatically, not
about adding a column manually via the user interface. One way to do it is
by executing a DDL (Data Definition Language) SQL statement ...

CurrentProject.Connection.Execute _
"ALTER TABLE Categories ADD COLUMN MyNewColumn int"

You can also do it via DAO or ADOX, if you prefer. For DAO, see the
CreateField method of the TableDef object. For ADOX ... um, well, for ADOX
you'd best ask someone else, I'm not really familiar enough with ADOX to
advise you.
 
Top