Question

I'm attempting to use an outer apply in an access pass-through query; however, it seems to have issues with the outer apply. The query is below. It runs fine in SQL Server directly, but when run as a pass-through query, I get a syntax error in the FROM clause.

The syntax error text is: "Syntax error in FROM clause" The pass-through will run and produce data when I text run it; however, when I attempt to save it for the report, the validation issue occurs.

SELECT AccountNumber, ICN, Provider, RequestDate, patLast, patFirst
FROM tblracaccounts
OUTER APPLY (
SELECT TOP 1 patLast, patFirst FROM tblAccts WHERE LEFT(icn,14)=LEFT(tblracaccounts.ICN,14)
) t2
WHERE ICN NOT IN (SELECT ICN FROM tblracstatuses WHERE Cancelled=1 OR Findings='No Findings')
ORDER BY Provider, RequestDate DESC
Was it helpful?

Solution

Reports do not allow the outer apply as a pass-through query directly in the report. Moving the query to an access pass-through query and then referencing that query in the report works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top