• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 235
  • Last Modified:

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...
0
Cindy Aitken
Asked:
Cindy Aitken
  • 3
  • 3
  • 2
1 Solution
 
Gustav BrockCIOCommented:
You miss a space:
dbs.Execute "ALTER TABLE RawList" & " " & "ADD COLUMN TimesUsed INTEGER(10);"

Open in new window

/gustav
0
 
Cindy AitkenAuthor Commented:
I copied and pasted your code into mine, still getting the syntax error. :(
0
 
Eric ShermanAccountant/DeveloperCommented:
Is there any specific reason you need two separate strings???

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


ET
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
Gustav BrockCIOCommented:
Oops. Integer doesn't go with a size:
dbs.Execute "ALTER TABLE RawList ADD COLUMN TimesUsed INTEGER;"

Open in new window


/gustav
0
 
Cindy AitkenAuthor Commented:
Nope, no reason other than that's how Microsoft's example worked.  I tried your suggestion, still getting the syntax error.
0
 
Eric ShermanAccountant/DeveloperCommented:
I think the syntax is ...  

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


ET
0
 
Cindy AitkenAuthor Commented:
Ha!  That's it!  Thank you, Gustav!
0
 
Gustav BrockCIOCommented:
You are welcome!

/gustav
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now