ms-accesspassthrupass-through

How to use local DB table in a pass-through query?


I am currently working on a query in Access 2010 and I am trying to get the below query to work. I have the connection string between my local DB and the server that I am passing through to working just fine.

Select column1 , column2 from serverDB.dbo.table1 where column1 in (Select column1 from tbl_Name1)

In this situation table1 is the table on the server that I am passing through to get to, but the tbl_Name1 is the table that is actually in my Access DB that I am trying to use to create constraints on the data that I am pulling from the server.

When I try to run the query, I am getting the error that it doesn't think tbl_Name1 exists.

Any help is appreciated!


Solution

  • I think the issue is that a pass through query is one that is run on the server. Since one of the tables is located on the local Access file, it won't find the table.

    Possible workaround if you must stay with the pass-through is you can build an SQL string with the results of the nested query rather than the query string itself (depending on the number of results this may or may not be practical)

    e.g. Instead of Select column1 from tbl_Name1 you use "c1result1","c1result2",....