Home > front end >  MS Access: "Cannot open any more databases."
MS Access: "Cannot open any more databases."

Time:02-05

The Access error, "Cannot open any more databases.", has been discussed several times on StackOverflow[enter image description here

The numbers in the tables are arbitrary. The fields ID_test_n are primary keys. The code above is the entire contents of TestModule. The query TestQuery is:

SELECT t_test_1.ID_test_1, TestFunction(ID_test_1,3) AS [Test code]
FROM t_test_1;

When the query is opened, it at first appears to be okay. But if I scroll down through it, it throws the "cannot open any more" error: enter image description here

I've discovered one way that I can get rid of the error. If I remove the first parameter of the function TestFunction(), so that it's definition becomes:

Public Function TestFunction(nID_test_2 As Integer) As Variant
...

and the call to it in the query becomes just:

TestFunction(3)

then I can scroll down and up through the query sheet multiple times without error. Those changes are possible because in the bare-bones code of the function, there is no reference to ID_test_1. But in the actual database, that parameter is passed for a reason and omitting it is not an option. Still, it is mysterious to me that whatever is causing the error does not happen if that parameter is not passed.

Can anyone see what's going on here, why I'm getting that error, and how to fix it without excluding parameters from the function?

Environment: Windows 10 Pro 64-bit, Access 2019.

CodePudding user response:

This may be due to a bug in an Office update, about Jan 26, 2022. See Reddit post

Try system restore to roll back the update; or...

Go into Access, File Options, Trust center and add the local front end directory and then check the box to then add the backend data location as a trusted location.

  •  Tags:  
  • Related