top of page

Query Reference to Remote Database Fails

Updated: 2 hours ago


Description

You get an error message with a query or SQL text that refers to a remote Access database, e.g. using an IN clause: SELECT * FROM Table1 IN 'd:\Foo\Some.accdb' or direct notation: SELECT * FROM [d:\Foo\Some.accdb].[Table1]


The most common error message is: "Operation is not supported for this type of object." If you try to run the query/SQL from VBA, this is runtime error 3251. The problem can happen within Access or in a different program like Excel that tries to get data from an Access database. Some forum discussions:


Microsoft Q&A

Stackoverflow

AWF


Cause

Microsoft has increased the security measures with regard to the execution of queries in remote databases. An optional registry key for this was already introduced in 2021 with KB5002984. The Office security updates from December 9, 2025, changed the default to block the execution even if the registry key doesn't exist.


Status

From Microsoft's point of view, this is not a bug but a security feature. Therefore, the only solutions available are the workarounds listed below.


A fix for a particular problem situation is currently available in the latest beta version (Build 19711.20000) and should become available in the productive Current Channel in the coming weeks. However, it only fixes the case where there is already a connection to an Access database and the same database is used again in an IN clause. This type of use, which in practice may e.g. occur in Excel, no longer throws error 3251 with the fix.


Workaround 1

If the problem occurs in a different program than Access, then check whether the registry key described in KB5002984 exists on your system and has the value 0 (=block). If so, you can set it to 1 to allow remote execution of queries from outside of Access. If the key does not exist, you can create it and set it to 1, as described in the KB article.


Workaround 2

If the problem occurs from within Access, it helps to declare the database with the external reference as Trusted (or set "Allow all macros").


Workaround 3

Especially if you do not have the permissions for the other workarounds:

Another method to avoid the reference to remote databases in Access queries/SQL is to use linked tables. So instead of using a SQL text like mentioned in the Description section above, you can create a link to Table1 in d:\Foo\Some.accdb, and then use the local linked table in your query or statement: SELECT * FROM Table1

If you need to reference different tables dynamically you can create or modify the link with VBA code using methods like TransferDatabase and RefreshLink.


Workaround 4

A temporary remedy is to roll back to an older build of Office/Access in which the problem does not yet occur, i.e. to 19426.20170 of Dec 3 or earlier.



If you encounter a variation of this problem, feel free to describe your specific issue in a comment on this article so that we can inform Microsoft about it.

9 Comments


Kent Gorrell
Kent Gorrell
Dec 26, 2025

Not having an issue so far. Looks like the previous developer was smart enough to add code to add the hard coded locations for the DBs called by IN as Trusted Locations.


Like
Karl Donaubauer
Karl Donaubauer
Dec 28, 2025
Replying to

It is not the databases being referenced that need to be in Trusted Locations, but, as stated in the article, the ones doing the referencing.

Edited
Like

henkdewole
Dec 21, 2025

We use the "IN" clause to access tables in databases that are encrypted, and to our knowledge the only way to ensure that the encryption password is not stored somewhere. Once opened using DAO.OpenDatabase the queries can freely be excuted and there is no need for a linked table with a connection string. So really important for us but if there are other approaches we would love to hear them. Btw we have not experienced this issue (yet).

Like
Karl Donaubauer
Karl Donaubauer
Dec 21, 2025
Replying to

Hi Henk, From where do you use this method? From within Access or from different programs? As I mentioned in the text of workaround 1+2, this makes a difference, possibly also in respect to what will be resolved by an upcoming fix/solution.

Like

Kent Gorrell
Kent Gorrell
Dec 19, 2025

Thanks Karl. I recently inherited a client who have extensively used IN in FROM clauses and may very well be exposed to this issue. Thanks for the heads up.

In my scenario, Workaround 2 would most likely work. I'll post back here if I get bit.

KB5002984 says "Starting May 11, 2021" Do we know why this is becoming and issue now? Is a recent 365 update involved?

Like
Kent Gorrell
Kent Gorrell
Dec 28, 2025
Replying to

Thanks Karl.

I can understand why MS have enforced security where the dbs are not in trusted locations. Although a forewarning may have been waranted.

I guess you could call a query in a malicious db that ran a function. Which raises the question: Does this also affect calling a vba function in another db that is not in a trusted location? Why you would do that is beyond me but in this app someone has.


This app I'm working on did that as well as using IN to call a query in a db that was a union query that itself called queries in other dbs.


Fortunately, all the dbs are in a trusted locaion. How do people come…

Like
bottom of page