By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,663 Members | 1,843 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,663 IT Pros & Developers. It's quick & easy.

Adding a table column using VBA/ADO

P: n/a
Re: Access 2000
Does anyone know how to add column to a table using ADO?
I need to add a column called "autonum" that has a datatype of
"AutoNumber" to a table called "MyTbl".

I have searched far and wide. Books and news group threads are coming
up nill.

Thanks,
RLN
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
rkc

"Ron Nolan" <rl**********@yahoo.com> wrote in message
news:13**************************@posting.google.c om...
Re: Access 2000
Does anyone know how to add column to a table using ADO?
I need to add a column called "autonum" that has a datatype of
"AutoNumber" to a table called "MyTbl".

I have searched far and wide. Books and news group threads are coming
up nill.


Far or wide is obviously relative.

http://msdn.microsoft.com/library/de...ml/imo0143.asp
Nov 13 '05 #2

P: n/a
"Ron Nolan" <rl**********@yahoo.com> wrote in message
news:13**************************@posting.google.c om...
Re: Access 2000
Does anyone know how to add column to a table using ADO?
I need to add a column called "autonum" that has a datatype of
"AutoNumber" to a table called "MyTbl".

I have searched far and wide. Books and news group threads are coming
up nill.

sql = "alter table MyTbl add id identity(1,1) not null"
CurrentProject.Connection.Execute sql, , adExecuteNoRecords

If you want to make it the primary key, (make sure you drop any existing PK
column first)

sql = "alter table MyTbl add id identity(1,1) not null constraint PK_MyTbl
primary key"
CurrentProject.Connection.Execute sql, , adExecuteNoRecords

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.