Results 1 to 4 of 4
  1. #1
    Sck is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Jul 2010
    Posts
    82

    ALTER TABLE query syntax error

    I am trying to run an a
    ALTER TABLE query via currentdb.execute sql, dbfailonError



    sql =
    ALTER TABLECopy_tblExportformat_Base_Monthly ADD COLUMN Jun-18 Long NOT NULL

    this fails with Err Number 3292 Description Syntax error in field definition

    if I change the sql to either of these:
    sql = ALTER TABLECopy_tblExportformat_Base_Monthly ADD COLUMN Jun18 Long NOT NULL
    sql = ALTER TABLECopy_tblExportformat_Base_Monthly ADD COLUMN 'Jun-18' Long NOT NULL

    it runs but I need the field name to be Jun-18 to match up with a Corporate system.

    thoughts/assistance?


  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Untested, but try bracketing the field name: [Jun-18]
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Sck is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Jul 2010
    Posts
    82
    perfect!! don't know why [ ] didn't register with me as the fix...… THANKS!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Happy to help! The brackets are usually the workaround when you have inadvisable spaces or symbols in an object name.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 09-10-2014, 11:30 AM
  2. Replies: 11
    Last Post: 05-01-2014, 11:56 AM
  3. Replies: 3
    Last Post: 03-05-2013, 11:17 AM
  4. Replies: 6
    Last Post: 05-30-2012, 12:32 PM
  5. Alter Table syntax error
    By markjkubicki in forum Programming
    Replies: 1
    Last Post: 02-06-2012, 05:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums