I found the problem. I thought I would let Access create the joins for me and 
so I opened the "Create query in Design view" wizard in Access and selected the 
tables and it calculated the joins correctly and it works fine in Access, SQL 
Server, MySQL, and PostgreSQL!

Here is the correct format:

FROM tbl_users u
  INNER JOIN (((tbl_conferences c
    INNER JOIN tbl_forums f
      ON c.ConferenceId = f.frn_ConferenceId) 
    INNER JOIN tbl_threads t
      ON f.ForumId = t.frn_ForumId) 
    INNER JOIN tbl_messages m 
      ON t.ThreadId = m.frn_ThreadId) 
    ON u.UserId = t.frn_UserId

Here is the bad format:

  FROM tbl_threads t
    INNER JOIN tbl_users u
      ON t.frn_UserId = u.UserId
    INNER JOIN tbl_forums f
      ON t.frn_ForumId = f.ForumId
    INNER JOIN tbl_conferences c
      ON f.frn_ConferenceId = c.ConferenceId
    INNER JOIN tbl_messages m
      ON t.ThreadId = m.frn_ThreadId

Aftershock Web Design, Inc.
by: Stan Winchester
President/Developer
http://www.aftershockweb.com/   
Phone 503-244-3440
Fax 503-244-3454

>I trying to get an application to work with MS Access and it threw the
>following error:
>
>================
>[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in
>query expression 't.frn_UserId = u.UserId INNER JOIN tbl_forums f ON
>t.frn_ForumId = f.ForumId'.
>
>Native Error Code      -3100
>SQL State      37000
>================
>This error happens on CFMX & BD 6.2 only when the data source is an Access
>database, when it is MySQL, SQL Server, or PostgreSQL it works fine. Here is
>the query:
>
>SQL    
>SELECT DISTINCT 
>t.ThreadName, t.frn_UserId, t.frn_ForumId, 
>t.DateCreated, t.ThreadId, t.IsReadonly, 
>t.IsActive, u.UserId, u.FirstName, u.LastName,
>f.ForumName 
>FROM tbl_threads t 
>          INNER JOIN tbl_users u 
>                   ON t.frn_UserId = u.UserId 
>          INNER JOIN tbl_forums f 
>                   ON t.frn_ForumId = f.ForumId
>
>BTW: This error happens site wide, but only with Access. Any ideas how to
>fix this. I've googled the error and came up with nothing.
>
>Thank you,
>Aftershock Web Design, Inc.
>by: Stan Winchester
>President/Developer
>http://www.aftershockweb.com/   
>Phone 503-244-3440
>Fax 503-244-3454

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:212003
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to