Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2013
    Location
    NYC
    Posts
    7

    Can't find the syntax error in this SQL

    I cannot find what is wrong with the following SQL, and yet it generates Error# 3075, stating that there is a "Syntax error (missing operator) in query expression 'F.TableID=T.TableID INNER JOIN XDatabases D ON D.DBID=T.DBID'. I have confirmed that mySQL="SELECT F.FieldName, F.Description, F.Comments, F.IsLocked FROM XFields F INNER JOIN XTables T ON F.TableID=T.TableID INNER JOIN XDatabases D ON D.DBID=T.DBID WHERE F.FieldName='ARRS' AND F.IsLocked=False AND D.DBID=2" and not just the latter "F.TableID=T.TableID INNER JOIN XDatabases D ON D.DBID=T.DBID" portion, so the error message itself is a bit puzzling.

    'This is the same SQL, but displayed here to make it easier to read.
    SELECT F.FieldName, F.Description, F.Comments, F.IsLocked


    FROM XFields F
    INNER JOIN XTables T ON F.TableID=T.TableID
    INNER JOIN XDatabases D ON D.DBID=T.DBID
    WHERE F.FieldName='ARRS'
    AND F.IsLocked=False
    AND D.DBID=2

    I have also tried using the wild card '*' instead of specifying particular fields, and eliminating the WHERE clause, but neither affect it. I have also determined that if I stop with just the first JOIN, it works, but that doesn't produce the needed results. So, it appears that my problem is somehow connected to the second JOIN, but I don't see how. I've tried removing the word 'INNER', and reversing which conditional expression is to the left of the equal sign, and which is to the right, but it still fails. Any ideas what I'm doing wrong here?

  2. #2
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    I think you need some parenthesis so that SQL knows which join to evaluate first. Perhaps this:

    SELECT F.fieldname, F.description, F.comments, F.islocked
    FROM (XFields F INNER JOIN XTables T ON F.tableID = T.TableID) INNER JOIN Xdatabases D ON T.DBID = D.DBID
    WHERE F.FieldName='ARRS' AND F.IsLocked=False AND D.DBID=2

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

Similar Threads

  1. Replies: 12
    Last Post: 09-14-2012, 04:59 PM
  2. Compile Error: Syntax Error in DoCmd.RunSQL Statement
    By Evilferret in forum Programming
    Replies: 1
    Last Post: 08-27-2012, 12:32 PM
  3. Replies: 6
    Last Post: 05-30-2012, 12:32 PM
  4. Replies: 5
    Last Post: 03-27-2012, 01:40 PM
  5. Incomplete Syntax Clause (syntax error)
    By ajetrumpet in forum Programming
    Replies: 4
    Last Post: 09-11-2010, 10:47 AM

Tags for this Thread

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