Solving Error 3048 "Cannot open anymore databases"

Kronix

Registered User.
Local time
Today, 23:10
Joined
Nov 2, 2017
Messages
102
Tell me if I did a clean workaround.

So I had the problem, after splitting my database, I would get Error 3048 "Cannot open anymore databases" when opening my report. My report shows a list of orders containing an item in a given time period. I pinpointed the problem to the subreport that contains the actual list of items. It is shown for each order in the list and has as its source a query containing all item orders in the database. It retrieves the appropriate items for each order from the query based on OrderID.

So what I did was saved a copy of the source query and changed it into an append query that adds the results of the query to a temporary table I created with the same fields. I also created another copy of the query and changed it to a delete query for the the same temptable. I then went to the main form that contains the button which calls the report. In the OnClick macro I added an action to run VBA code and placed it before the action that opens the report. The RunCode action opens a VBA function fncTempTabelle() I put in the main form's module as follows:

Code:
Function fncTempTable() 'Temporary Table is used to avoid Database Connections error.
    Dim dbs As DAO.Database

    Set dbs = CurrentDb

    dbs.Execute "qryTempTableErase" 'Clean any previous usage of the table
    dbs.Execute "qryTempTableGen" 'Populate the table with current items

    Set dbs = Nothing

End Function

It works. Does all this look good? Did I miss an easier way to solve this whole problem?

BTW, I did this in the split frontend and realized the temp table is now in the frontend, so I had to go back to the unsplit database, add all this stuff I did, and split it again. Which made me wonder, is there a way to create a table from the front end that is stored on the back end?
 
for me, it is better to left the temp table in the FE as you are deleting and re-inserting records to it, the BE will tend to bloat.


it is easier to compact/repair on the fe.


your last question, yes you can create a table on the BE, either by opening the BE and create the table. on the FE create a link to that table.
or you can create through VBA.
 
My preference is to use a temp database. When I need a temp table I create a temp database in the apps root folder upon start up. I then have template tables in my front end for any temp tables I may need. This makes it easier to make changes to them when needed. When I have to use a temp table I select the template into the temp database, link to it, and use it. When done I unlink the tables and delete the temp database. Very little bloat to mysysNameMap table caused by the linking and unlinking but not as much as deleting data.

heres a sample of some of the code.
 

Attachments

Users who are viewing this thread

Back
Top Bottom