Results 1 to 2 of 2
  1. #1
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496

    Alter Table syntax error

    i have code that checks to see if a column exists in a table; and, if not, adds the column to that table.
    in this case the new column data type is text with a field size of 5 characters

    the <edited> code is

    vFieldName = rsNewFields![newfieldname]


    vFieldType = rsNewFields![DataType]
    vFieldSize = rsNewFields![FieldSize]

    sSQL = "Alter Table tbeFixtureSchedulePrintOptions ADD " & vFieldName & " " & vFieldType & "(" & vFieldSize & ")"
    DbNewFields.Execute (sSQL), dbFailOnError

    which generates this line of code:

    Alter Table tbeFixtureSchedulePrintOptions ADD AIASectionNumber dbText(15)

    and results in this error:
    3292 syntax error

    any thoughts would be greatly appreciated in advance
    thnx Mark

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Access 2007--Alter table using vb.
    By bcofie in forum Access
    Replies: 1
    Last Post: 12-29-2011, 08:13 PM
  2. Compile Error Syntax Error
    By Mohamed in forum Access
    Replies: 3
    Last Post: 10-06-2011, 10:12 AM
  3. Alter table Yes/No field
    By Cojack in forum Queries
    Replies: 7
    Last Post: 10-27-2010, 11:31 AM
  4. Incomplete Syntax Clause (syntax error)
    By ajetrumpet in forum Programming
    Replies: 4
    Last Post: 09-11-2010, 10:47 AM
  5. sql syntax error
    By SMAlvarez in forum Access
    Replies: 1
    Last Post: 03-12-2009, 09: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