Avatar of Cindy Aitken
Cindy Aitken
 asked on

Syntax error in Alter Table statement

I'm using an example of the Alter Table statement from Microsoft's Developer Network website (https://msdn.microsoft.com/en-us/library/bb177883(v=office.12).aspx), but I'm getting a syntax error.  I changed the table and column names, but other than that, it's exactly like Microsoft's example.  The table was created earlier with a make-table query.  What am I doing wrong?

Set dbs = CurrentDb
dbs.Execute "ALTER TABLE RawList" & "ADD COLUMN TimesUsed INTEGER(10);"

I browsed topics and solutions, but didn't find an answer.  TIA for any suggestions...
Microsoft Access

Avatar of undefined
Last Comment
Gustav Brock

8/22/2022 - Mon
Gustav Brock

You miss a space:
dbs.Execute "ALTER TABLE RawList" & " " & "ADD COLUMN TimesUsed INTEGER(10);"

Open in new window

/gustav
Cindy Aitken

ASKER
I copied and pasted your code into mine, still getting the syntax error. :(
Eric Sherman

Is there any specific reason you need two separate strings???

dbs.Execute "ALTER TABLE RawList ADD COLUMN TimesUsed INTEGER(10);"


ET
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ASKER CERTIFIED SOLUTION
Gustav Brock

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Cindy Aitken

ASKER
Nope, no reason other than that's how Microsoft's example worked.  I tried your suggestion, still getting the syntax error.
Eric Sherman

I think the syntax is ...  

dbs.Execute "ALTER TABLE RawList ADD TimesUsed INTEGER;"


ET
Cindy Aitken

ASKER
Ha!  That's it!  Thank you, Gustav!
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Gustav Brock

You are welcome!

/gustav