We help IT Professionals succeed at work.

Syntax error in Alter Table statement

Cindy Aitken
Cindy Aitken asked
on
598 Views
Last Modified: 2016-09-26
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...
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018

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

Open in new window

/gustav

Author

Commented:
I copied and pasted your code into mine, still getting the syntax error. :(
Eric ShermanAccountant/Developer
CERTIFIED EXPERT

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

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


ET
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Nope, no reason other than that's how Microsoft's example worked.  I tried your suggestion, still getting the syntax error.
Eric ShermanAccountant/Developer
CERTIFIED EXPERT

Commented:
I think the syntax is ...  

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


ET

Author

Commented:
Ha!  That's it!  Thank you, Gustav!
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
You are welcome!

/gustav

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.