ALTER COLUMN question

B

BobV

Group:

I can't figure out why the ALTER COLUMN statement does not set the default
value to 0. Here is my code:

BackDb.Execute "ALTER TABLE [Table1] ADD COLUMN [ItemID] Number;"
BackDb.Execute "ALTER TABLE [Table1] ALTER COLUMN [ItemID] SET DEFAULT
""0"";"

According to page 179 of the "Access 2002 Desktop Developer's Handbook" by
Paul Litwin, Ken Getz and Mike Gunderloy, this should set the default value
to 0 for the column named ItemID. I first add the column named ItemID, then
I want to set the default to 0.

Any suggestions?

Thanks,
BobV
 
M

Michel Walsh

Hi,


Works only with ADO. Try CurrentProject.Connection.Execute "ALTER TABLE ...
". You don't need the " around the 0 if you don't use the ; ( a bug is
implied in the SQL parser when using the ; , with some Access versions).


Hoping it may help,
Vanderghast, Access MVP

it
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top