ACCESS SQL 'Syntax error in FROM clause' - Can you help me find the bug?

The following SQL Statement apparently has a typo.  I can't find it though.  It should be an easy 500 points.  Here it is (remember it is Access):
SELECT DISTINCT VA.CallerID AS Client_ID, VB.[Date] AS Encounter, '1' AS Opt 
FROM ((((qry_Disability_Referral_Counts AS VA 
INNER JOIN qry_CallLog_Rel_CallType AS VB ON VB.Caller = VA.CallerID) 
INNER JOIN qry_Calls_Rel_Vet_Services AS VV On VV.Call_ID = VB.Call_ID) 
LEFT OUTER JOIN qry_War_Counts AS VW On VW.callerid = VA.CallerID) 
LEFT OUTER JOIN qry_Race_Counts AS VR On VR.callerid = VA.CallerID) 
LEFT OUTER JOIN qry_VA_Referral_ Counts AS VC ON VC.callerid = VA.CallerID 
WHERE VB.Call_Type_ID = 2 
UNION ALL 
SELECT DISTINCT VA.CallerID AS Client_ID, VB.[Date] AS Encounter, '0' AS Opt 
FROM ((((qry_Disability_Referral_Counts AS VA 
INNER JOIN qry_CallLog_Rel_CallType AS VB ON VB.Caller = VA.CallerID)
INNER JOIN qry_Calls_Rel_Vet_Services VV On VV.Call_ID = VB.Call_ID) 
LEFT OUTER JOIN qry_War_Counts AS VW On VW.callerid = VA.CallerID) 
LEFT OUTER JOIN qry_Race_Counts AS VR On VR.callerid = VA.CallerID) 
LEFT OUTER JOIN qry_VA_Referral_Counts AS VC ON VC.callerid = VA.CallerID 
WHERE VB.Call_Type_ID <> 2;

Open in new window

LVL 15
David L. HansenProgrammer AnalystAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
David L. HansenConnect With a Mentor Programmer AnalystAuthor Commented:
Found it.  There is an extra blank in the table name in the last LEFT OUTER JOIN (before the UNION ALL) just after one of the underscores. Wheew! Thanks though!
0
 
UnifiedISCommented:
I would start by removing all the parentheses
0
 
David L. HansenProgrammer AnalystAuthor Commented:
It's Access.  It is a requirement when working with multiple joins....see this link:
http://nm1m.blogspot.de/2007/10/multiple-left-joins-in-ms-access.html
I know...weird huh?
0
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

 
UnifiedISCommented:
Ok, then it looks like you are missing a set for the final query in each part of your union
0
 
UnifiedISCommented:
Are you able to use the Design view to build this query?  It doesn't look too complicated to create and then you can use the SQL view to see exactly what Access wants.
0
 
UnifiedISCommented:
I also notice in the link you provided that the first table is contained within parentheses but in your queries, they are not.

I think the from would then look like this with a 5th "(" and the ")" after the VA alias

FROM ((((qry_Disability_Referral_Counts AS VA)
0
 
David L. HansenProgrammer AnalystAuthor Commented:
You'd think huh?  But just changing that one space made the whole thing work superbly...go figure.
0
 
David L. HansenProgrammer AnalystAuthor Commented:
Found the bug on my own.  Very grateful for someone looking at it with me though.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.