Access to the db engine has strict parenthesis requirements when the SELECT statement contains more than one join. I suggest you start with a simplified version of the query (drop the list of fields and the WHERE clause) so that you can focus on the correct connection.
SELECT * FROM (salesforce AS a INNER JOIN portal AS b ON a.loannumber = b.loannumber) LEFT JOIN agents AS ag ON b.agentid = ag.agentid;
Assuming this version works, try the following:
SELECT a.agentname AS [Salesforce AgentName], a.loannumber, ag.agentname AS [portal agentname] FROM (salesforce AS a INNER JOIN portal AS b ON a.loannumber = b.loannumber) LEFT JOIN agents AS ag ON b.agentid = ag.agentid WHERE a.agentname <> ag.agentname;
Notice that I enclose aliases for column names with square brackets instead of single quotes. Single quotes will not cause an error, but they will be included in the column heading ... that I doubt you want.
You will do a favor by creating Access queries in the Access query designer. This makes it difficult to create a query with syntax that the db engine will not accept.
Change If the purpose of this query is to compare agent name values ββfrom Salesforce tables and agents, you might want to try this as a WHERE clause:
WHERE a.agentname <> ag.agentname OR ag.agentname Is Null;
source share