Consider the following code.
DECLARE @sql VARCHAR(MAX)
SELECT @sql = 'SELECT * FROM caseinformation'
EXEC(@sql)
When I run this in SSMS, it displays the same results as it would had I run SELECT * FROM caseinformation. But when I run this as an Access pass-through query, I get the following error message:
Pass-through query with ReturnsRecords property set to True did not return any records.
What gives?
Add the following at the beginning of your dynamic pass-through query:
and you will be able to use the query from MS Access.
Why this works, I’ll have to leave for others to explain, but I know it does work.