title: MS Access occassional "Cannot open any more databases" error
body: <p>I have an MS Access (2013) application with a split database. Everything seems to run smoothly except for occasionally I will get <code>Error 3048: Cannot open any more databases.</code> </p>
  
  <p>The error occurs when the front end tries to run vba code which involves pulling data from the back end and will stall on any line with: <code>Set DB = OpenDatabase()</code> or <code>DoCmd.RunSQL()</code> commands.</p>
  
  <p>The strange thing is that this error seems to be time based. I can access the back end hundreds of times without error if I do it quickly enough but after some time has passed (~1 hr) the error shows up. In fact, I can open the application and leave it running in the background (with no code running) then go back into it after an hour and I will get the error the first time the code tries to open the back end. </p>
  
  <p>I've searched the length and breath of this site and google for solutions so I know this error has been addressed before. To save people reiterating the usual fixes I will list what I've tested for so far with no success:</p>
  
  <ul>
  <li><p><strong>Recordset limit:</strong> I'm not leaving any recordsets open, every time I open    one I make sure to close it. The same for the databases. All my requests
  to the back end are done via 3 or 4 vba functions and each of these has
  a <code>Rec.Close</code> or <code>DB.Close</code> corresponding to every <code>OpenRecordset()</code>
  and <code>OpenDatabase()</code> and I never have more than 2 recordsets open at
  a time.</p></li>
  <li><p><strong>Control limit:</strong> I have 151 controls on the biggest form in the application so I should be below the limit (I believe this is 245 for a single form?)</p></li>
  <li><p><strong>Corrupt database:</strong> I've copied all my forms and code to a new Access database and run a Compact and Repair.</p></li>
  <li><p><strong>Machine Issue:</strong> I've tested the application on several machines and reproduced the same error.</p></li>
  </ul>
  
  <p>Anyway with most of the above situations I would expect the application not to run at all, instead of running fine for a set amount of time and then crashing.</p>
  
  <p>Some other points of note:</p>
  
  <ul>
  <li><p><em>Citrix Users:</em> The users are split between normal windows machines users who are experiencing this error and others who are using the application through a virtual desktop software (Citrix) who are having no issues. Unfortunately I don't know enough about this virtual desktop to really work out what that implies.</p></li>
  <li><p><em>Background vs Foreground:</em> Some users have claimed that the application only crashes if it has been running for a long time AND they switch over to another program and switch back. I've confirmed that simply switching between the application and other programs doesn't cause it to crash but haven't yet been able to leave it running in the foreground long enough to confirm if it crashes without switching between programs.</p></li>
  </ul>
  
  <p>I've been struggling with this for days, anyone able to help me out?</p>