I'm getting stuck trying to create a count of occurrences of every Filename from MainTable in myQuery. With Access (yes I know) complaining about a missing operator in the first join, which does work if I remove the second.
I did try to simplify this to cut down on reading. As far as I can there isn't a missing operator. Let me know if there's a better way to do this or if you can spot the problem.
SELECT DISTINCT
mainTable.Filename,
mainTable.Link,
otherTable.Field,
qryC.Total
FROM mainTable
LEFT JOIN otherTable
ON mainTable.number = otherTable.position_nbr
LEFT JOIN
(SELECT Filename, Count(*) As
Total FROM otherQuery
GROUP BY Filename
) As qryC
ON mainTable.Filename = qryC.Filename
WHERE (((mainTable.Filename) IS NOT NULL
OR (mainTable.Filename) <> ""));