Results 1 to 2 of 2
  1. #1
    EddieN1 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    313

    SQL Server: Incorrect Syntax near "("

    I am building a SQL string in VBA in order to update selected records. The SQL string, sSql, is the following:



    UPDATE (NTbl_Boom_Detail AS D INNER JOIN NTbl_Boom_Detail_D1 AS D1 ON D.AssortmentID = D1.AssortmentID) INNER JOIN NTbl_Colors AS C ON D.Color = C.Color SET D.Climate = "ALL" WHERE D.ArticleNum="570077459" AND C.ColorCode="BLK 000001";

    When I try to use the Cnxn.Execute sSql,dbFailOnError command, I get an Incorrect Syntax near "(" error message from SQL Server.

    If I copy and paste the sSql string into the SQL view of an Access query, it runs fine.

    Can someone tell my why Access takes the SQL string, but SQL Server doesn't?

    Thanks, Eddie

  2. #2
    EddieN1 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    313
    Okay... I found part of the problem... I don't need the link to NTbl_Boom_Detail_D1... I removed that and the AS D and AS C so now the statement is...

    UPDATE NTbl_Boom_Detail INNER JOIN NTbl_Colors ON NTbl_Boom_Detail.Color = NTbl_Colors.Color SET Climate="ALL" WHERE NTbl_Colors.ColorCode="BLK 000001";

    Now the message I get is "Invalid Syntax near the keyword INNER"

    Thoughts? Thanks, Eddie

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

Similar Threads

  1. Replies: 2
    Last Post: 03-08-2013, 12:59 PM
  2. Replies: 11
    Last Post: 03-29-2012, 02:32 PM
  3. Replies: 13
    Last Post: 12-05-2011, 05:10 AM
  4. Incorrect syntax near keyword “ORDER"
    By k9drh in forum Import/Export Data
    Replies: 1
    Last Post: 06-13-2011, 07:36 AM
  5. error "OLE Server isn't registered"
    By newtoAccess in forum Forms
    Replies: 1
    Last Post: 12-26-2010, 10:51 AM

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