new field in a table of a sql database

R

Renate

Hi,

I try to add a new column to a sql database using an Access project.

I tried this

Dim DB As Database

Set DB = CurrentDb

CurrentProject.Connection.Execute "ALTER TABLE Artikel ADD COLUMN HS_SN
Int;", dbSQLPassThrough

DB.Close

But I always get the message

Incorrect syntax near the keyword column

Does anybody know what`s wrong?

Viele Grüße

Renate
 
T

Tom Ellison

Dear Renate:

To add a column, do not use the keyword COLUMN.

ALTER TABLE Artikel ADD HS_SN Int;

You may want to specify NULL or NOT NULL rather than default this. I
make it a practice to always specify this to make sure I'm getting it
correct.

Grüß Gott,
Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 

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